// ==UserScript==
// @name           Castle Age Autoplayer
// @namespace      caap
// @description    Auto player for Castle Age
// @version        140.25.0
// @dev            19
// @license        GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// ==/UserScript==

/*jslint white: true, browser: true, devel: true, undef: true, nomen: true, bitwise: true, plusplus: true, immed: true, regexp: true, eqeqeq: true, newcap: true */
/*global window,escape,jQuery,$j,rison,utility,$u,chrome,CAAP_SCOPE_RUN */
/*jslint maxlen: 512 */

//////////////////////////////////
//       Globals
//////////////////////////////////

(function () {
    var caapVersion   = "140.25.0",
        devVersion    = "19",
        hiddenVar     = true,
        caap_timeout  = 0,
        image64       = {},
        offline       = {},
        config        = {},
        state         = {},
        css           = {},
        gm            = null,
        ss            = null,
        sort          = {},
        schedule      = {},
        general       = {},
        monster       = {},
        guild_monster = {},
        //arena         = {},
        festival      = {},
        feed          = {},
        battle        = {},
        town          = {},
        spreadsheet   = {},
        gifting       = {},
        army          = {},
        caap          = {};

    /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
    /*jslint sub: true */
    String.prototype['uniConv'] = String.prototype.uniConv = function () {
        return this.replace(/\\u([0-9a-f]{4})/gmi, function ($1, $2) {
            return String.fromCharCode(parseInt($2, 16));
        });
    };

    String.prototype['unescapeDouble'] = String.prototype.unescapeDouble = function () {
        var meta = {
                "t": "\t",
                "n": "\n",
                "r": "\r",
                "f": "\f",
                "b": "\b",
                '"': '"',
                "'": "'",
                "/": "/"
            };

        return this.replace(new RegExp("\\\\(.)", "gm"), function ($1, $2) {
            var chr = meta[$2];
            return chr;
        });
    };

    String.prototype['unescapeCAHTML'] = String.prototype.unescapeCAHTML = function () {
        return this.uniConv().unescapeDouble();
    };

    String.prototype['stripCaap'] = String.prototype.stripCaap = function () {
        return this.replace(/caap_/i, '');
    };

    String.prototype['numberOnly'] = String.prototype.numberOnly = function () {
        return parseFloat(this.replace(new RegExp("[^\\d\\.]", "g"), ''));
    };

    String.prototype['parseTimer'] = String.prototype.parseTimer = function () {
        var a = [],
            b = 0,
            i = 0,
            l = 0;

        a = this.split(':');
        for (i = 0, l = a.length; i < l; i += 1) {
            b = b * 60 + parseInt(a[i], 10);
        }

        if (isNaN(b)) {
            b = -1;
        }

        return b;
    };
    /*jslint sub: false */

    ////////////////////////////////////////////////////////////////////
    //                          image64 OBJECT
    // this is the object for base64 encoded images
    /////////////////////////////////////////////////////////////////////

    image64 = {
        header:         "iVBORw0KGgoAAAANSUhEUgAAAK8AAAAuCAYAAABefkkIAAAACXBIWXMAAAsTAAALEwEAmpwYAAA" +
                        "AIGNIUk0AAIcbAACL/wAA/lUAAIJ8AAB9MwAA680AADo7AAAjQeoHuS0AAEBfSURBVHja7L13tC" +
                        "TXdd77O6GqOt84d+5kTMIgDDIBEARIgBQDCGZCIi3KJGXJlCVaVraCn2VRyfaTLNnSkywqS6TE8" +
                        "JgjxASCAJFzGGCAweSZO+Hm7q506oT3RzWGoABJ9Hqyn/2MWutO6HW7uvrUPufs/e3v+0qEEHjh" +
                        "eOH4X/HQP/XrH/q2F5TSPPX0Ezz5zc8QRWtpr19PPlxY50S0xa4uvASqNuBAhOCs0kkybIxvvNO" +
                        "H7IB0Zn7zlktQjYYsbOoFAgQIIVk6eYx0ZRHnAQJaCZARBIPP+8iki9QNvPeAxYdAohLaU+so01" +
                        "X6y8dRcQsdtWivXY/JCqSOyJdOQPD0Np5NcAEkSCmIZcLyqQO4YoXu5CxlllLmOUlnjOHiKaTUB" +
                        "OkRQlBfpIQg8KG+PlFfOgKIo4jxdRsxecry6cNI1SGECik1+ICzBSG4+jRBIAGZ9KjKFYKvCD6i" +
                        "1ekxvmELociZP7YfD0gR8MEjhEQIQQgOJXR9I6Qm+IBUARCEYGm2uzTHJvnqx//k772pb33vr9T" +
                        "3Usq/83csIRrOH/tnrgpruus2/5ci5ClCPO/vtkZjIYXAFDn9uaN47wio0TgFhHBAwAcJQiGwCA" +
                        "UIhRYCIUGqmNktW6BynDq2H+8FSBAoAJyzuODRQuGwSKGRUhG8Q4oAQqHiiOkN2/jAf3ofWil15" +
                        "iK99wihkErRmt4GQV41WDr6g9t2bL3+oosvXrNl44a4lUgajRZBgneBvDDsffpAev99Dx2dO7zv" +
                        "swvzR/+wMT55qCpyQSAIIfC2Iu/3EULVcf/C8d/1SHRMZUsGq0sI+TwBKQS2KM4+a8vmX203WzM" +
                        "PP/7UkWR84oM2XcI/z04cxidRWv3Pt/IeO3qwjnrvmFkzjRAJWX95FmHfe+755/zkP3vn93Q2b1" +
                        "jD3Xfdy2N7n+Dogf3EnQ75MGdqaoILLryA7/+e17d/4Sd+6JxPff6r5/zpn33wxqWFkz+opf6GQ" +
                        "CDwmCLlhezkf9zRaLRIQgNjckxVjnaXbwtHynx4/Q2vuHZm7fo1PPTgg/+UovVJm2YpPM+NGp/4" +
                        "nzNtWFg4AUBlPe1WxOKp49tX5g79wU/+1I++6vve8ir++kMf5dfe90scOzaHjlunlNJ71p618xW" +
                        "D5fmTBw8evPXmm2/b/Gd/9oErvvttb5U/92PvYd++fds/84Wvv7yzbss3CEC2ihUCxwvR+z/q8N" +
                        "4hhKLV7FIWKeFvBa+3dmJivPc91119Od1uwlmbN7z02MnF17TG137SltWzY5ykk6C1xoeA/DvSi" +
                        "v/Pgnd86iyEUFRVyf79B2ZDsfLH//aXfuHlr3vZ5fzcL7yPz3/ub4ibjXRq9qzPJr01/1UIUUXK" +
                        "39Vqdx8yaXh7pyubujnxir/64Ed/9OTpxevLvCAWXIBZFUo2ghMK5z3eBcDjnQcCLgiE9hAczjm" +
                        "wDoTHBw94nAsE+cyACbyzYD1SObwLBBfwMuC8h+AJIdSfIUCEev1wvn79mVwueI/3Hu8soc57QM" +
                        "o6s5UBvCD4b+W89Q4bCFqfyY2dtQThCaH+EcHjnIVg68QwyHqaOo93FcE7gocQQn0OIXCuIgBBh" +
                        "DPXV+e8nlGZcOY99TcRde7837B9heBIkhZJFGOq6szqGwi4yr7k4itfdEkcCTRw9UuubH7045++" +
                        "Ufnq88sn+mY0CARgZtc6hFTIEBAIhJB4Z7HOEfDPynnr++aDAuEROKQHhK/HXwVioZBCEUR9Dyp" +
                        "XlxpylEpa6/Ah1OOLw8uAlA7vPVoEhLAIrRCizuW1jjroOIJiIIvVxX/1zne9/eWvf/mLed+//w" +
                        "3+5ktfpzM2+WSrt+Zfq97E55VIgslWL1WRxg1K1V5zFq1uLz99+OkvJHFyx+3fvOt9rVbrezq93" +
                        "tNx1ERGTVHlp36k3e1eGTwVwWN9iAQBKUUQUnuB8z5ueBk3hdBaBR9kwAUfiHGhX5X5r4dgX9fu" +
                        "Tr5caO2lUMKlSw188DhcI9EWEGZ5rkcQLhCElcJUQrpYBUGzvWRL82sQrmm0Gm8U0tMdn7RCSIL" +
                        "wCCk9gRCEQDxTsIWAEASB8EKJWISQVkX+67jqVZ2xieukalUhOCmk9MIH730Cz0ySAAKJjJrCVS" +
                        "KE4INAIaOkUZXFbwdbremMT74doY3Eaz8KVgQ2hKCU0FaEEILURQgIpUKbgAIfVBQlhPAY8JvfS" +
                        "QALIeh017CyfAI5yn29V3Tbze87b9um+H3/8Xd57z9/N9decSlfuOmrNxQmv7K3qXvbmQkfAsFk" +
                        "FDZ75oxYW753fHr6+7SOSx8EQoRRMVcvNEKq0XvrvTZAXcBGQlSli4p0+Ks435qYnPkZpRMTRAg" +
                        "CiZAC78EHP1qwPEJK8ALvPVIEhFZUxjbLbPW3gI/rl165lc/ffCeuyndu237Wu9/+xu/ic1/4Ij" +
                        "fd9HWSZnKyPb32PZEeuw0Zk6+cIuufFO3O2QSTB6WF2Lj7paG7dhv9U4eWh6unf9xXxe8KHc9v3" +
                        "H1VGCyeUMNT+3/21/7PX98y0Y6x1oEIowRCoJVGIqi8H42NhyBBghKS3/ydP+Khe27//OTM+h/6" +
                        "lV9736WzU12sNQTqlSqJE6JIQgDrHVpI8tLgvAOhSOKY3/q9P+Hur9/y1fHZmXf8yi/929evWzt" +
                        "JEIJEq3pkg0PICCEkITgCYbQKQmkqkqTBf3n/X3Drl79429jUmmt+/Vd/+Z2bZ6fIM4PQ0GjGSK" +
                        "moCkPlLSGAD/VXgYCQ9XX+/p9/iFu/+pWPN9udt/7iL/3iu7dvnCHNC6SUNJMIoVQdLH6EdEiJM" +
                        "RVV5RBK0EgS/ugDH+XB+x644zsN3hACUZyggaoqEYDJzQW7L7noVVma8qWbvsiFl1zCja+6mt3n" +
                        "nTt+z72PvEmPxbdZLASPHQ7xCwMqX+FqmAiPuOZnf/bnX3Ll7rNJiwwCxEmMEhFpPmC1P8A7T9K" +
                        "IGev1SKIGpTPEKuavPvFZvvLFz1wldeLf++M//pIXX3QuWV4gAB9qdAE8CIkcbUFaaQj1xGu1m7" +
                        "z/Lz/EnfffexaAnupITj71AErKK1/7ju+e9abkc1/6GpWp7NjaDT+jW53bgvEIX+FsBiZTwVck3" +
                        "UlXDpfDwqE9JO1xps86l3a2nmNP3L4/ZH18ZbCVQUZxtma8xURbYSo32gUFjTjmvgcewjh4yeUX" +
                        "UZQGKSTgiaKIqqywWVpIJZ1SOp2d7LJ+somxEVJq4jjikcce56Yv3czKcECn1WXj+lled/2rmBy" +
                        "fhBDw3mEGKwS8Fah8ZmKM7Rsm+PLXbuOzN32FRMd1xqDkKFWog7Yyhl3n7ubd3/tWGlpQZX2ESo" +
                        "z3IVs71WPjTI/SGI6fOM1f/OmHWVia5/U3vI5dO7cQKU233SL4gAsBpSRSCGzaxztnfQjlzHiTt" +
                        "eNNiqZgfmmZD330bzh9Ym40pQU+1O9923ffyCUXnIuvKqSSmLSPNWX+35IXCiHoTmwgW14FLQh+" +
                        "4V3nn7Nt+u577kZHSfaN2+5Ur7h8d/KSKy/knnvve6PK3e8mjfhItnQKn/ZRcUyz08WWBbbIsMg" +
                        "SZ/F2SLCGVhKz/+m9/M3XbuHgoSN4qZFSIoInbiRc+5IXc/UVL6LRTOgvncRHshRSBmEtlCnClv" +
                        "QHGf/3pz7HwQNPE0cxSIkPHuscb3nTW/mua67AlAXCBoaL8wgpIgBdmoqiNIx125dt2bROHT5ym" +
                        "H1PHULGzVt0Y+zDrqpQQmCdpzu1jkTrQXAu2LLAIzl9+DGkbEJTE6uYSDVIB6c5cN+XsVifRIla" +
                        "XekTKoWt7JkBTbXmI5/4LHlocP7ZOymrlBDqbVdpTWUMAU+sW15pbVeHfVq6oqwczUaD2++4m9/" +
                        "47d/h8pdez5VXX8H02Bi33HEXTx48zvk7qD8rBCobYLSqrgwHLC5KHth7mBdf8yq2bJhBKsXHPv" +
                        "NFHnnwIX7+F36Glo7IK8PNt93NwWMnWDfZxlpH0uyMa6VMf5CytCTJioJOs8lSanng4f386I9u4" +
                        "9jcSZK4wcxkVeOgPiCVQgqBsxVaxyihWO2nLK0sk+UFrWaLrIQHHjnIT/70j7G0vIJEorQAGbO0" +
                        "OE8IASkVzpoz+d4/FLDPrLwhBHQUYX2Byc22DWvXvEUIy94nnnRTMxv+7dHDhy+55+G979y9YyM" +
                        "bN87uPDK38BqZ+T+u8gwh6zxcKkk81sNWJQpFWeYM+kNsCNx88y188KOfZP3WHdz43e+g0+lA8L" +
                        "RaCfc8+Cgf/OQXQDV52YvOp7IOKSKEhLIs6A9TsqKg1WwwMbWWOx54mJ/+iX+Ocw5jKtqtFr1Ww" +
                        "vLKKs5ZjK2ovKXMcwmgl5YWX9mI4x+ZmJl9UbOZsLy8QpQ0aevmucIVH4mkAhG8xAUBNm53pzvd" +
                        "jnA+vMg68VGtBcJZ603lPYWIpAyt3iQhhD42/FrwsizyDO1rRKPeRmP279vPkaOnsMQ88tRBdm6" +
                        "cJCtLhJBESlOWJUIGVKSkkjIxRcFw6PEBvDN88Su3MHvWbn76h9/B3iefZvuWSc4963WkxrC0vI" +
                        "JWEu8DIVikqtc0U5Qsrw649sWXsnHtNMGWxElCIiqa7TY7Nq4hER4kdBtXEyrLoD/AWYOOoo5Sk" +
                        "SuKjDQVZGVJSCoayjO5ZoqGhmwwgA6kKVhX525SSST1ShrrCB1pjClJ04yiKOsVPxS0x7pcdfFO" +
                        "9u8/QKPZZmaqS5aV9PtDpFQoLfA28J0U/M65rhBivZSyAwQhJa3xLmb51FvOO3vHtkce2cPKSv9" +
                        "Aq21PO+fFrXffz87Na7hk97k8ffBLPxwrtaC0NgSJlFKEgNMquk2qaOgDlFVFVVXcec+9/MWHP8" +
                        "4lL34Z//IHvhdMxqEjx0HGTEQxr3vZZZy1bi3NRpN+f4B1ps7vEVhjyIdDsrIAbymyVaJIs2nNB" +
                        "MP+ErbVZuP0BJkp6Q9W6kLPVrgaSREAup9nNjjjTZZVeZrRlA4B6LjZllJu8t7pQFACMoLPELSt" +
                        "cwQfegouds6vEnDKSR+EFwhs0huTJstOUpbKK6fyokRUFdbV2a5rNfjGnfdwyVUv5cihQ9x8611" +
                        "suPGV5FkOBJSOqEqD9XX1HfChKAyZtFgfaCQRcaNNemqO+x56BBE8CwtLVM4i6tqXSElssPjg6m" +
                        "JFQF7k5ENHKwqcPn0Sj6DViDHG4Aksr/aJQ0HloZtogisYpgHrHECOQBd5yXAIhTH4ymKqiuAFw" +
                        "/6AssgRMiLVDjsKNKUkglAPuhZIIShLQ572SQsL3mJKiwdWVlboD/pYB7iCyroznTIpwQWHUP/w" +
                        "ynv8wAOXNFq9n1mzbvsFzrlG8C4oFVXr153Vunj3LnGgkzA7u2mnbqi/soUhSRJWVlfYsWU9G9d" +
                        "vuLQ/zP5ca2mFlG0hRbCmmi9XV15DYC9C4KqKhcUFbv7m3azZvI13fc8bWDh+GGNKhmmGVCVLqx" +
                        "63aJkdbxKEZ2V1maqyZyafMRVpNiQ3pt4hKwfBk2cZRVZSUbG45LA+nGmsuEjjKoeuVyN0CPaWf" +
                        "DB/y5Kv/tPKSv+nGxMaUxXYSv5x1Bn7OZlEZMNlvLVBxzEmW72sKjv3VaZ6LG71riuLdIgPCCGR" +
                        "QJACISuE83jvBEJERZGBqPABoihi7shRnj54gp/48bdy2zcDX7/1Po5ddQkTLYHxIIWpA2p0Xo+" +
                        "gLAsy7zAuYArN1VdczP7Dc/zpX3yE6667mjXjbbIsJSCRUlDKiOBHaYqMESiKsmSYVhhTQ1UKsC" +
                        "bCuopYJeRZSmlzvAtkok5fpJQE76nKdCmJenFZ5AyGhqqqMKXCVQahJIPhgGE6JEiJCqruVkqJV" +
                        "qqGvpxFSkEURZRlyTCz5EVJcGWdUgjJE3v3MTd3hNXMsmv7JiZ7HUIALTVCBJytvjP8M/CkTYd/" +
                        "cHzvA+ujbtc12mN+dWn+ey++cPf1ex59mLvvvZ/e2DhKKobZEO8tq0sLXHnRuayd6jE/f+ogrcZ" +
                        "/NSupE1I6lSSu2R07FRaXsAisNczNneD0wjJXXH0t/fk5FuYXiJKIfj9DRTHSFgRA65QQAkopnH" +
                        "V12iMkpirJ0oysLCmynLLMEEJz130PkfbnWR4WnLdzBxtnpnEhEEUSo2OsqxBSBAAtvUNHHXyQ1" +
                        "aGjx9gwsY3NGzfx2OP7pq1NQ7M3U29bsaJcXcTZQuvOGBazWg5XhkgJosZBpQBkhJcWWxqsLVVD" +
                        "tMnzgmG+TL9f0Gg2eOixx6hc4Lavf4XDRw9TDPvc+cCjnLt1LaYwdHotYq1HYDvgPVmWI7QhBJi" +
                        "fz8ktvO767+Lu+x7mS1/6OseOHuW8s7fRSBqMdxOkUnhrCWGEaohAZXKGwKnTyxTWIaQk0posq4" +
                        "DAwSNzeJPjQ73arZnq0dDqGRRCCCl9WWZkQpAXhqVhRloYCI79h48xd3KR9rAklgEvYHq8SzPWh" +
                        "BCw1bd2gNLkZMNAf1hyPDdkpaUsMz7xxZuxpmBpcRUZNVk7kZFEERNjLQgBa2s05Ds4ThH8TdZb" +
                        "Ws02caND0hy+fMuGNdx+2zc5dHQua7YGJxu9iW3lYOWzcadTDPfuf9vOrZvYtXUDjz+1fzxudr7" +
                        "h4als8TQNLfEuwmBBaCpTsZj2kVGEc44DR06QZTlaa/pZThQnZJnk1Pwyg+EKOm5yztYthKpGm5" +
                        "CCqqpIs5Q0L0kLQ1YGgnc8uu8psJ7TS4v0pmZqGE5LJrottCjx5pk0EPRgWNKd3kzAfX3Pnn3/6" +
                        "oIds+1zzt7Ck08euDSK21PG5ovKCHZc8iKOH3iChYN7pfOeumnuZLC5D2oCrSqElHWjQAZ8cPiq" +
                        "Dp6yzKmKEpU0MFXFwaOLbDxrKydWCsZmzuIs2+SJpw6wfctG4kTgPORZBtYihUJJQWlyMAUhCJS" +
                        "CbhQzEyvWvvoqvn5Xj0efeAIRN7n6op2URYEfAfs60jSaTXQSUeYlurK0Wwm9SCFQRJEiSRQImB" +
                        "rvImyEH21VripJjSd40DICKSgKg7IVpnKMt2uoTgjJ1HiXbNCn3W7SjCQuBFxlGJo6r60JR/WeW" +
                        "RYlqbVYa5kc66KloNnq8C/e9TZOnDjB6X7GxjUTCFfgnScbZqNmjuU763FJhFb0JtYSN9r0Vxcv" +
                        "3rhu7Q395QVOLy4xsWbDRxrt1leFVO/vdnq/76X4cjZc6e05cPj63VtmmZmaOGsxK9/caLd/48g" +
                        "DDyKJWXf2i4gIBAJlaegkCiUllcmY6M6SKJBagK+I4pjJbkJ/kHL3/QfZtXs3vU4b40pQAgiYqi" +
                        "JNPdZbxjttIuEQWnLj9ddTpKvMDwqmx9uIyuC9JU9TtFIYbwgj7Ezf8cg+9EQHb8pvHD9x9JZ7H" +
                        "93/ugt3rOO8C869aM+eff+60Rv/+RAsSaPJ7he/mrvmj1spZRBgpRABnVB5X+eaPlykVPWrHvHX" +
                        "SaP9UV/kSAlFVhJMTiOBvQf2YQPccO2lHD96hMnJSfZ3Yr745ds5fuIk29d1sFmgrMo631F19Wz" +
                        "yAu8zvBPISCBCShrAVYYLtq1jYqzNHXfex7bZCSbaCQ5fb1Pe0W61XKPVWq2sITcFla+7VkqAij" +
                        "RVniMkpIM+vhzU3TcCUtZ/B+/QkUJLJcsyRxQlxnmqIqfMMqSSDFdXWV1dxjtHpRyhptPVoH3wO" +
                        "FfVW2YIVGVJVpVUtsJXFSYfIoTgxNxRjh45zPjUNPnKPJWtasB/BD15585MgL/vOP+Sy1nq9ylM" +
                        "hXCOSPDmzbPTM/v3PYnUzVPdsfHf8CJsqorct8a7obIFQobfPnj46LWbpjrNzeummd+z/y0h0h9" +
                        "O1p911OQpwRmUSghCkpuCVuKYmprgqX37WTfWpBN5HJLBMEc3DVQKYTOEVkyOT5L1l3GVG42pxJ" +
                        "iSLAdnPcZY8myIUpJTJ4+xtHCKZnuMlAxrHEKOmHpa4aw9QzbSUbUCFQh86Zvhdx9+9OFrE5F3r" +
                        "ti9GWvtj+0/MHcIxB+ayoTZyVkm1521mqd9IwW5wwQdj4OxuqrMq7ds2fDrk9NjFz/8wINNIeQn" +
                        "kMEFAWWZY/McU5bseeowuy64kuVTxzg2N0eWZfR0YKzX5vF9B1nT2470gbwydWdlVICVxmBtgXc" +
                        "BMzTEWpPEDSoXyMuUqaatE3mZUBQ5zjuc81TW4hVBKOHK0uBsVkNyI0gpsgopIWnElNbg8gwf6t" +
                        "VUSEYBA1EUI5USpjR4m2Kdx0pJGKUY1lq8rSEyh8daS+UckY4IwRKcR0oFUmBKQ/BDXACv3KipI" +
                        "vHe4fGUhUFJjw2esqqItSKEgHPuO0IbfuDtb+KvvnwzD+8/RDLMZjvd5pusyThxap5Gu/s5CE/m" +
                        "w+VztUqEs2kpbE4ziW4ZDMovHZ1bfPP0WEy3FV1qXP7iqTW7jq6uFMi2JhQ5QQiq0lD4kp2bNnL" +
                        "Xo09yx0OPc/H29Ux22/WCYT1BB4psQKgMaTok1QrrLEpIEFBZS5lVWO+IbIxzvp7woz9tVWFlPY" +
                        "ZFURBHMVopXGWRYZTzxvG3KIpStb5cLqz+0p13PvC+s3eu7+7etr4ZRxt/Z9/+A9cd2HPvH2Vpe" +
                        "vOgvyyUECWEKARmhZaXtLR+w+ZNm9525aW7pu765h0UZSXiJMKPGLFFWRDKgsMnTpAVgp0bplmY" +
                        "P4KzVb0NJ4H1Mz2e2DfH4XWTzI5pKutrJlpNCqWoDBQpsdLs2XeAkyeX2Tg7SbOZYBwcOXSY9We" +
                        "dx9R4k7njJ0h0ow7G4AkiCBdQVVniqmLE2RVIJShMoMhThOyRrvQRrsSP4ByEILi6zZk0YhojZM" +
                        "IUQ4IHIwJpPsS4Bk/te5qTp+bodHtQlSwsr7LhrO2sm2hTliU2OFD1Z+bW4EwOXuK0ocwznIV9T" +
                        "x/g5NxxOt0VhCs4vbjC2o1b2by2hy2LGnP9DnBe6x3BOHw2oDTFNds3rT1/bu4oxjOY7o5/qFhe" +
                        "wfsCms2AoyqLCBnpSsjsL48vLF0/lkw0Jrut+PDC8js67bFPC2OquNmhrAx4j7UVw3xILCSX797" +
                        "FU0dPcveeg0y3BQ2tSdo99g+WOXZqHtGbYnJinCKbx9kKF0BIjasqSltQOkusCrJsiKssjz7+JK" +
                        "sLJ4lbHWSoWFpcYnbLTravn6AyBc55vJQeQBOpb2sn4vxvS53M7dl37I9OLJzublk/G19x8c63L" +
                        "6fFaxdPPP6VSHniZk9VJrp8TXv6Y2vXzZy7dXZqimrA17/0OQ4cW6bRmJpTUlgbKgVgXcVgeYXj" +
                        "S5ZNZ+8iHS4zHA4QQuNxZFlOuxkxvW6WpdTSjgXCFxAcUtSroKsMviyxlKxdu4725GbyPGMxTbH" +
                        "Bsf3iq7jivG2cOvY0VWEIuv5cQiCSOmgpK+MsmHI0KQSxhYV+RtyepNseZyktacuSOj2VSEE90/" +
                        "HESUwcxxhb4YuSEASDNKPZGmes0+PQyT7WN0hXK6rS0uyuY/3sLIP5o7ggcM6NAq9ePYqiJADpq" +
                        "iFKusz0uhw4tkxwMWm/wFuLbEyzedMmssVjNRHGu1E38B9uU/gsE35xcff0ujU/t36qHX310ZPE" +
                        "rd7tOorucThAGEcIKEKj1QQZUVX2kf4gPbaUNnbMTrVZHhbXl7b8gWa38ZGgZF8mSXB5gbMOYw3" +
                        "OOZQquHj7OnK/kcXVAcPBKqbyqO4Ml559EWetX4tZXWQhrSe8QCBDwAVHYeqxXq4qGp0eO2c3kV" +
                        "YGOTZNkIqysvQ2jHP2ju3ki3ME7wneI1RdsunFJ/Z+ez/cGKa37PwIKjlyaqn4VwtL+97SjHQyO" +
                        "T7Vm52auLHZHkfJGB9UWwR/Tbp8jDv3PcjJ00tUoYFUzSWB+QQyRgQvJCGqihIXKnafs4lWs0l/" +
                        "YY6yLFBSUw4LnK3oNJpcc+EmhFQU+YB0pcBZD3ghQJdFTpUOAIWWgnWtJslkG+QEURSBs+x//L6" +
                        "6OaB0ve3YqmarBQQhdKqywGVDgpegBCWeJFZcvGszcRxhypLBIK9RjlFa4aoK7zxSKHzw0uQF5b" +
                        "A/4uFIzt+2llazQQiToy09EKREAEunjlDmWc1Acw6tJCCkyXN8OsCHenXftX2WdqsJYdTGd6HOc" +
                        "0VgcPowaZ5CCDhvv6OV13hzmfPmx+K48bbpbjfZ9+RjBKJCwu2DhcVcSoH3QXlvtJI9j/RUZpWq" +
                        "KM9Fqw0n5lcI2RKxajaKUvxOFfx7lRl8XzDFY0KJOM8y8uFSjdtLYGEerTXj7R5rZiaIkgiJxBZ" +
                        "L7Lt/H6WzaKkpqxKlEoSQOktTisEiNgSkkqwf75E0FIIONR9HEo3y+5OHn6TIM7SUGFMg4m6d89" +
                        "o8f05rMQRHubJyR3dq6g5k4xVl6d5+YrF/3eHjJ9aAmggugLCEoEFqJ3SyqJKJFS3crSA/UFbmN" +
                        "oUg7kx6F8TTd9z94FlVtkJgH95bpIpHnxNqAoZSNSGjpnQhRjffR+1Goz0WPJy49/49lOkiUkaj" +
                        "XeKZzX3EfxQSpWpZSv2dRzc5apC0xpeFVK377n+UcrjEiPkymq3PfC4IJZBKo5Qc0SgVwluI2zS" +
                        "7nQhkdf9Dj1CuLoHWIOpCIhDq9GJEzaypi3VgSq3AB0TUQre6WuuoePDhPRTDRYQaSX68G3XaxN" +
                        "+Cwmo6v9S6porGLVQSt/6h4J2eGPeJVlWRD/ft3fuUqky+MWq0v45U30R6ZZ3zPshHdPA/7Sq/N" +
                        "8+WKQcLtMZnyfPB3cOB2+CLcqcgJ2p1EhXHTed91er2IMijT+7bj0mX62pEylEjCZw/WjNLfU1j" +
                        "RNQ4NyMJkWy0aI03E62jI/v2H6BYXSRI6vGXo5b+KGmTKIQQ9SKiFUgFvgIVMzW9pm4P/22ZiOA" +
                        "Z7qsbEdq4GSlu1o1kprtm3eRgceliAm0pVelx41JFi77icW+yZaLoSF5ZTFWi0SSttofwfS53b1" +
                        "ATU9ux5SaExAeE8xVSaF/rkwT+TKYpQAYPQsVRZHRn7PHgq5/zqftqMrGjV5nBbiXECDMSQYiaV" +
                        "CpQ7szl13BqEAKllFyMosaTcdL6haGXt3Rnpy6uXNkh4IMInqAQoobOlZL+maaEEKN5IBFCiEqo" +
                        "5J44ad0shNjXmd54YTUctHSkg9RSeBd8qCeDDN4LUznpsFIgpfPWeuu8EsIgwmM6Tu6qQni02Rw" +
                        "7x1qznuCtrEmxoubFinBmBvpQExMFQQihhQhWEG7/h4K33Wo+lMTRD1uTic7slrHpdneLLctl4d" +
                        "zx063EmpDTPrl4WArxx8FX9I8fpzIFjc7El7Wzt3Qn10yURbE7H6yGqNHynV537/LK6lEdNdFR/" +
                        "CvOVp9p9CYuI9gNlcmdqLVy9V4koNFq15RqCd556UIQUgihhRLpYOFjUqnH43bnsUa39yJTmU1K" +
                        "CmetJUkaAilCqEdD2LL0SmrhKhOiRAsZx75Mh6fjZutrAOLic895TvBOb9lOv79Kd2oSoSVFUaG" +
                        "aMetmz+bkkf1UZUbQLbwdkiiFEF2qsk+IG5SmojIlWjfp9GaQAoLJiJodqHKIapGlKQbEjRa2KE" +
                        "Y80+rMDK0XTUXc6qCaLYK3hDwnafbI+qdH/HFxZmWqf198GymlzhUEUdKqK9WoSZYP6Yx1cZUF5" +
                        "0BCGBWEUtTbF0JisgGEgBrNAK0jkBFx0sRWJUmnxfD0HIlOEEpQVQ7daqN0jPeWyjicr1BRA2st" +
                        "/cWTxEmXEEqiRgdrCpRuUJYpOIcaYZ/gz3Sg6ukXzhDrhQwIpZAIPvnB978gFwGkqyq+/cfW+WJ" +
                        "VopttvHffKuYQaBXTXnv22VFj/JUzO69u8J3Ke0INcBPCGZGfH239f997/t7/f2cf/NzreNb2/q" +
                        "1/e4IP/+BnBF9zbp85c3hWsfvt5/3b5/J//3W9cPy3y4C6M+uf8+Km3VeiGk3WbNzKob33cOTJR" +
                        "0gSfWbQIyXeG7eSd5s8fSNw2wvD+HcfebYo8mJJ5XbF9VozL0TsP2bwvuxdP/GclUlpPdIqObZf" +
                        "eA3BC+ZPHgTvCcnYxk2za173smuuGv/DP/vA9/99wXvLZ/7w/xeD9I73/NRzXksz85Jcue8OIeR" +
                        "lkTtjToUo0iRxLKTWZINcW+eORLF4OFGdRxvtiWEI306s+eJH/uiFCPx/E7zPAxHirP029GHXZS" +
                        "9j5vQOlo8dpjL5K158+UU73nj9tXzyU5959UrUPNcOlp74306hG/zWbGX53Y1Wp/PGN9wQn7NzG" +
                        "3OnToev33qnmzt+Qm/YvJ6zz95unXXFI488/tDK0uJ/bvY6n3wh5P4Rc16eyc2e/fOsUK4ZURVj" +
                        "07OsppXotjtvvfrFl9HScMnFF2y0Vf6m/x0Hrttu/PXBuz6169Ajt/3IICuGr7z2xTjrs4duvem" +
                        "JxSOPP3TwqT0H7rz1ln3n7NrR/I+/8rPXXHjpRR88tufen3oh5P4xg/cfaNWcWWmco8yHF55z7q" +
                        "5rDh89zvziCte+5AriSL4p7v1P6krx3/m45sYfX5ject7XDh04sDRIhywtLkUXvOyGC5PxDV/Qn" +
                        "TW3HNv32Bv+5E/+/Pa8MPzMe3+wdel1r/vFR27645e/EHb/SGnDf/jhG7/thXf/zH+uo1oqVpdP" +
                        "+nQwXwPRSCKl33TBrm1Tf/iHf8ab3vwWXnfdlWxYO3v58dOL1zW37fxU7i0NIWlXhqQ/4A3f/6M" +
                        "IpViem/+9S6647AfGOmPeOiuEHBkWeE8QZ8AgpJAiBB9CCCgd88gjj3H6xNwbpmcm33/xpZdtdi" +
                        "N5ghAi4Gtjg1pn9cw8EyIEF6QUZHmlHrj//ptMkX/svAvO+/MNGzd5UxohpRxBAR6oMdUQ/AgsC" +
                        "xB8iHTC/kOH9NEjR//61s/95Xs+9Me/fWZ8rv+eH4KlZbwz4DPaEzPWemfSQU4IgQ/83r/n2te+" +
                        "QygVNy9/7b/cv7x46Pc/d9OXr/ypH/nB5LWvum78gVtv+qFHv/D+rwO85NUn3rF+47r/et7uC3R" +
                        "VGiGkCAIRQvB150OO/B5qpjQhuKCkZmmlrx9+6OE/wLtjF1128b+fmpx2VWWErEnaocapa0168D" +
                        "X6GoIP4NE64Ym9e9Xxw0fe3JsY+7UXXf6i3cETgghCIPzIA+PMuIoRgBmCC0IITOXkfffdf0+Zp" +
                        "r+989ydHz1r67ZQX7sMghDCs4wv/va1RzrhyLHj+skn9v54EqnLLrvyinc1Gk3vvRNCiprMUisQ" +
                        "Rs0aUd+X4MLhg3vve0b6LpP4P3zk93/rs/rvRqk8rdY4vrLU5Jp0bN3M1FvwnoP793P73fdy/bU" +
                        "v4vLLLlCHP/2V1yqlPmWO7yMAzXaHEDfOYK7OFsl73/29zZ2b1lJWBq0VlXO1LATwoZaIR6omtV" +
                        "fWoZXix37+V9n32HFx6WUXd3/1Z97TKnKDlAHnfG3IpiKsNzgXiLRGCUXlKlpJg/se3svdt9/Sz" +
                        "Por6o03XN980ytfTJrmIDxaRzjnGWY5BOh2mgghqawheEG33ebXf/dPOPjU49nfHpcydGqYS7YR" +
                        "KoBdghBEXuQYZ0d4TA2nHT36FL12cs/BQ0dWl5dXZiYnxkJ3YubclUOsQ3Ai7S+q8y94de+Xf/I" +
                        "HRZYWVM4Qx0mtBCkNla2I4qgex9F97bU7fO4rt3LXbTc3pJD6+//JjY0rLtxRfzc8fgQZK6kwlU" +
                        "FqOerc1X4Ssdb861/+TR5/8C65Y9f29r/7yX/RCtYgR04ARWme1cEUSC1JVIRxFZGMePrwMe676" +
                        "/b2YOWkeOXL39N611tfRX+QIgjESc0Os9bivB/RSDUheKz19Lptfu9PP8z9d9wcNdZtavzUj7y7" +
                        "uXasRVYUJElSG6I4jw8OrSIQYK0lAIOBefmzpO+Tz1+wPQu31EmDWHcosgyCePV552y/eM/jj6M" +
                        "azf0HDh7qP/rkwUsu2X02n73pq68LQe4YW7vlabO6UDulfHvjo+wPBux5apXb7nqQQ0dOsHnjLJ" +
                        "dddC69bov55T7tOOauBx5lYbnPNZdfxLbN6yiyLCgpbVU5s7TU5+SpE3z4019mds0kcRxx4tQig" +
                        "zRjy4ZZBIGTCyu89YZr2bh2hlMn5wjWeymkSQcpS4vLrA5WiSPJI3sP8dBjT5NoxVJ/QLPZ4Jor" +
                        "LmLnWevIi4p0kNBfXiQEMXzOuLh8xNON8UESiAjek2bZtwpdjxBSysHyKXwubKexoRqkQ4qsCN6" +
                        "5GGhTU5VNVRi7tNSPllcW2HfwGPc+/ATDQcY5O8+i12uza/sW2o2kdpIJgbw1YPH0SUTASSnM6u" +
                        "qA+VPzDLLhmXJFK8nHPvs1tmzZyBWXnIOz7ownipKSdDBASWmDD+bkqVPcctudPLp3P0kSc8Gur" +
                        "Vyyeycrgwzn4eixOe55+Almpie54RVXsbi4jLfOSSFNlmasrqxy5PgcDz5xgCf3H2NqvEuv02Jx" +
                        "uc94r8vc6SWuveJ8tm9ZRzbss7y4iJTKETDLy6uUg2XufWgPj+w9gBCCdTOTrAxSnHe8/ruuYWa" +
                        "qR2ks7Wbz2dL36nlzXin1yM2x7vvrlsbQV0kk3t7rtnn44YdDkjR/dbC0+P7b7rqfiU6HbVs2rs" +
                        "+y5ddVRU69X9XWSmGEXkipq2GWsmaiTbfb5HOf/wrdVpO1kz2yYUY2LJme7KKkoD8YsHXTWvKio" +
                        "LZCTWzA+6JIOXT4GN5aLr1gF5ect5P7H3qUx/Y+zQXn7uRFF+6C4Nl/8AhFkVOaAq0VUkXG2JIs" +
                        "G2BtxSe+cAsf+Mhnuejcbbzm5Zfz4ssuZOvGtfz2H3yQW+94AO8saZbivSWSz+OMWPSh6OPKVYQ" +
                        "vkMLivQ95ltXk8Tp6ZUCoVqsBcPbU1MSErwxHjh/3g6UTK8AigFCRcd75LBtQFAXbNs0wN3eKO+" +
                        "56gLO3bqDbbpGlOcMsJcsysjwnyzKqyhApHaTUVWFyhtmQNMvI8gxbluw/dIyPffpLPHXgGFVpS" +
                        "NOsfn+WU6TZCKtPrPfBOVdx4XlbOXbsOJ//wlcZ63bQSjEYZEghiGPNY3ue4oJdZ9FpJqRpipIC" +
                        "reLKWstgsEqiBVvWr+Fr37iX1UHKZbu3smX9NBecs5mxTszj+w7VGsQsw7oKpbRXQlRZNoTg2LV" +
                        "9I9+8/V6OHZ/jqsvO56JztnHfA3v4N7/2f/HU/mNURUl/mNIfDp+RvtvnXXmXF46f32i239TqTq" +
                        "7xwemk0fK9iXWNLbMTL03iiKjZrcZajR/03k8uLq3QT4dctHsXTz19+N/oKHqpbDZjpFBSimBN+" +
                        "VeBcB9AkRcMVoc0I02r1aTZ0AzTAelwSFnk9PsD4lgzOdYjz1OyrKDOJmQIzjMcDlESrrvqIhpa" +
                        "oLWgmSTIyhNHkkYiufbKC8nynP5wSF7kCKkQCCpjKMuShx7dy4c/dhM/8M43s2n9FKsrK+TZkAv" +
                        "O2ca+A2fz/g98gv/jx/8Z69ZO4ZxHPtv/9VlQIohahk2g9HVnbphmVCOTOuucjqEpEDu11j978X" +
                        "lnt04sLIU77ry7GJx48p7mmu3LU9suJU+HeFuRpUOyYYrWina7wdhEByU86WCAVpLg5Jl1RnhLW" +
                        "VUIqUGEYIqiDtw0rb3Ymg2+fsf9VJVlzxNPsvySC850NIUQyJEXA6r2vR0OB0RK8n03Xs9/+J2/" +
                        "4Mu33sXG2ddSZClSCe55YA9veu3L2Dg7xWp/laLIa5KMlKGqSrJhRn84QHhLs9UgiRRaBCIJkRR" +
                        "cev5WTs2v0F8dkCQRtrLEcQeEJMtzBsJgraPVadFpt2jHmolOk9e/6qX8wZ98mK/eejdve8N1CG" +
                        "ufLX0Pzxu8w1MHx4tm91KTD7Yh0QREZcy2nVftboViyGuuuypuNBsvzbKMqjQcOXyEdVM9pqbGZ" +
                        "1aHwxcJKU8LaAQQ0oVJCA0hVFzmhmGakudFnUMXOUWWUxQFVWUoi4KqrP8eDlOKoiAEG9AqDgHV" +
                        "7w9pNSJCEKwOhiSxrk3zgifPcqoyEEcSrZr0+6uURTnyjFZJZRxpOuRr37yfZqvB9k1rWVpaxlm" +
                        "LMYZ+v8/5OzbxhS/dyi13PMB33/BSrDXfYik9u/Hyxb/i2hv+6fqk2fwVqVRSmbLnnJ9NhwOiSO" +
                        "nrXv3muUbSqRSl7nYaN19+6aUbms2Yj33mb8Rj93yjOb3jxTs6M1v/wAvxJZHnifNBDIcZw7wWW" +
                        "7qqwvlAmmUYY7DGUCDxIy4rwWKKAlQQoJKyrMiGfbK8QinBqflFTp9a5A03XMdNX7qNJ/YdYsfW" +
                        "9ZRlrZiWUtRaOCEjkDpLc0wxZGaqx2tecRWf+cItnHf2ZjatXcNDjz5FfzjkwrMvZ2FxmSSJ6uA" +
                        "FhFCJqxz9dEia5xhTT9yqMhR5vTusrg6oKsO66R79QZ+WbVA5g0oaSkgdF3lB6gI21Du1s5ZBlp" +
                        "IVGaY0tfOODKTDFKH1s6Xv8nmDV0XRnc7k9y2dOKBmtp1fVUW5MdJ8LR8sb/3rT36m9jrojFHmQ" +
                        "4MUfufZ5zTe/KqrmZ0eZ2l19WtS8LNlf1CKKHbtsZ5TSrlBP5dlOaQ/sOR5DlIwf+o0CY5+VpBb" +
                        "AS7n1OnTlJVlOBhSlmXNo5VK+ODEMB1QpEMGwyFFURIrSWlKKgfH5+ZqupyU9DptOs0mZVbUxm9" +
                        "KSWsLFhYWOXDoOGO9NieOHasFks6zPKjAluRFTiNJOHRsjuXllRGXWDzHCfu6N70ToYStsuGJqN" +
                        "nSWicTPnibphlaCbtm7bqpvDCxjiNm1q7lyLFT3PKNb7ojj91xpDGx8c6JrReteFP2XJ4HKZX03" +
                        "onBcEA2HLKYZ/QHQ5yxHD58lP7QkGYZGofSik6nTbCWoixqx3CENGXGcCgZpDllmnH3o/toNSQb" +
                        "Z7qoSHPr3Q+SSIeII1pJUjP4rEdqKULwIk0HmCJlfj5n67pxZmYm+dQXv8H1L30Rd9zzGC+5dBf" +
                        "Hjh8naTToNJu1ilsKpJKytIbhcEiapiwsLkOA+flFHn18H/OrGQeOz1OVBefumKURN/HWYo3FmY" +
                        "zQjEWRp6gqkBUF3lakwyEHDxxgaTXjK7c9yOR4j3WTXeYXF+i028+WvovnDd7gnBdSl53JjeAVZ" +
                        "Z7uOP/cbbMHD+7HCV022+2/TMbXvFUkjT/UUeOmU8v9j59YXJrduXkdT+w/fE1zbKJpiv7iwuHH" +
                        "YMs5xHECSviiKEmHjiIvEQiMkBip8EJhvcM4cChclZNlKWVRjrwPRPD4kKUpeTqkMA6L+hbzSgS" +
                        "MD6ggCU5Q5gV4V6uNkQglfGUMg8GAIisY77WphCIAVjq8qDDOI3WMijVZVrDa79dCP/Fc9swtn/" +
                        "kg173hnaeL4covGmtod8c3EOJX5Gk6fmp+0Txx3833dyc3TAul9L57vnibGfYLm68+DHw5mdxyp" +
                        "CxqCZAUIJT4J9bVu0KWDqmcqL10BTip8EJinQcl8U5Q1IpFTGlqPrSUvjQjE5SyYiUzzM0v84pr" +
                        "LqWVxGzbup69Tx3h4t27mOxJcp8iAiMtnAoeH9I0xRRD8tKDjnnNdVfw8c/fwie/eBsvuux81s5" +
                        "MMzQOQcnQO4oR/1tI6U1lSIcDsjzHBOqaJTUcPtVnmJecWlxl3ZoJbBUoXEqwhqoyte+CJBRFTh" +
                        "AGYwNCaRZWBnz59kd57ImDnHvONm68/mp8EGRZiZTy2dL35w/e5tgUSdIganQxlSGK1Vsnuknzr" +
                        "seO0Z6Yvqk3NvWbpcmv6/Wmj1vhbs/T1T/au//wv7tw+wamxro7Bmn+Kh/48/7KEdJ0AYB1O19G" +
                        "WZakIicr6gJeBUPiK8pg0K4kDjGRcLUV0nBAaSzWe5RUiEBdcAxTkAEtFHqECYngiXyGFJqAI8s" +
                        "CttJkRQFSoKSitJYiy2g0Y0pjkL6eQMI7pM9QQeMdBOdItMTk2ciN8rnHdd/zozV+IiWOgHMlhJ" +
                        "bMsozgfPzYE09ed/Urb/zjVm/aLB178l/afJVkbD0T570CqRVCt2qvW2/OPG8hzVLSYUocK+RIg" +
                        "Bh5g/I52ocaNgqePA84qylNbYulhcaUhmxQ4YPn6LETeGtZmF/AWUcSKcrKMHf8GJOtTaS5HVmJ" +
                        "1kJIGQR5nlMM03oslWLdRMLWzWs5cPgU29b1wJbE2NG4Ksq6KEcpRXCOdJiSlznCepwPTI83OW/" +
                        "TOCcWVtg6s56icjiTYazHxhprbG1QIxRFXlD5gkCdEk1NdXnJRds5OneauROnsMU2klhhCkcu/L" +
                        "Ol7/55g3fbzl0sLC9TWYO1+a6ZqYnXrC4uMsxM6E1P/pF15aq3RVN1Ok4ricn8B+ZOzL9n68zYu" +
                        "vXTPfnEwbk3xu3eR3u7rsl0JJFKoZ3UxpSkrs7hpJYM+yn9doNhXpCVlv5AMRgOCcHXM7msCN4H" +
                        "qZQKAZlnKdnIdd4DkZZ4V5tQDwcpElkT2oPAJhpT1NaZSkbaVoaykqyZ7HLk+AIrKyvEKqJyjjT" +
                        "NaSeapX5GWVrWTHUpypLKWIQUzy3YtMInbZqdkiipsWznHXmWUTl7pqYTKg7rLn4jZvk0nemzhF" +
                        "NVw4eQByeQUY0VK2N08EHkWUqeZxgjqUpD8I7BYMgwK5DBo5Ss/RKspdduYsoSKYQQUumqNAyFp" +
                        "TKW/Yfn2DQ7QTZMMc4y3m2yZnqMR548zOaZcYIE4cO3ilGBzPOMIqsfu+ChrhsERFrV6Yn3uFD3" +
                        "kWyiyfKihrmljpy1ZFlKUeZUpsZHTVmyOuzTTzOme21aGlZXB4QAzWaEcQYplZRCqrIsEFXtqBO" +
                        "8w1mHwnPVhVv5/C0P89XbH+baK3bhbM1rfpb0PTwvVPbOG2+gOzVBXyoqU1090WltPXb0KFEc3x" +
                        "spdVveX2p4TyNUVemNpZG09hfGfurY6WUmuk2U5GWxjnZ3Qo+WmGC8uQYdRZjSMEyHSBxJFLOwN" +
                        "KAqC/K8xBQlrqxN8JqRpMxzijwjBFd7v0rI8pw8zyiKAlMUtbFI3WWjLErKIscUJaYoKPK81sgp" +
                        "QdLQWOvIhilbN0xinefA4dN4azBFjikN3hiePnyCdjNiy5oxBoM+3lWo5ynYrPUEoWl3eyRxhJK" +
                        "1+fEwTfEjnFegAtL5eGwtU9uvIPgKlw09pvg2Lm+S1HMjyzLyPMcUxci1PVCZelxMWRJcxYn5ZY" +
                        "4eX6h9gE2BjBRJoilsRVXkHDo+j5aCrbMTrJ1oMtNrMt1rcPamNcwvDDh+erE2tytzgndESYSSi" +
                        "jwvyL5tXEvs6HsUuaEs6+uqxzXDmBwtIWnUjZ4sq4twU5Z1k6SqMEVBVZYYU+JdycHjSyyvDjB5" +
                        "jq8qdKSIY01RGLL8meKc0Uo+pB0rdp+9gX2HT7Bn3zGCK+trzLJnpO/PzypzzkKeUy2c7E51u2/" +
                        "TGOaXlmhMbvi0s27oiqIn4ybWGm+sRKoYKD99amH5+7uz462JTnNyYVi+bWpd6x5rAiiBEgmlNZ" +
                        "giRQrBtk2T7D9yislejFa1ifKTR1LyrGTr7BiDNMVWtjYpThK0iiiK+gaPJCf4PGDMqDJPa5gpj" +
                        "Jbl2EmKojZuTpJmvTUPc7oNycXnrOPx/XNEWjDWjjFlweOHhhw9scil52wAbxhkNXwDwj6HnzuQ" +
                        "xNJB259JK1wIoSjyMzcd4YMQWvh8hTwsM2Kvl3/7XI1mEyUhzzPyLKPUimFekBeW00urmKrCeYt" +
                        "Zsjx5eJ7zt86Q50OKqiJSikazQXAVK/mQPfuPs3ntOHk2xHhqLzVracQC7xwPP3WMK8/bhJCByl" +
                        "mSJCGKNWWRf2tcPRgjGBYlprJk2QARGmceJxBbQV6Utb9yozFKZTJKYyiMx3ro54bF5WFtuCcCC" +
                        "33DUr9gqjtOlqWYqiKOIhpJgq0KyizDWiiNJS1K+mlte7ppps1wOMm9jxxC4dl+1uyzpe/PH7yV" +
                        "C7OuMpdq5961a9vG1yydOIonWVTwDVsVSC1sPXMbtNoNqsKQV4nPjfODrGCm1yAz9j2F8QbEJwj" +
                        "uuBo9r8xXjiBg16YJWg3FwWOLNJsx1nq0luzcPFY/48E6rKvbglLVRh3e1XZHMkgq51lazZmd7i" +
                        "GAxdWUyV6ClBCCpHLyjJGHeMZeyNUKkc1ru7QSzYmFVRb7CmdrS/orzltPq5nULjMCfG0r/5y0N" +
                        "1KesWaB+JaSoiFD6BhTEGqrHYRUhTdFKNJTiGCJ22uJogZBwLNng1S1w7uv6u/bH2b0WjGtJGJ+" +
                        "eYAQgkFmKI1lutekldRycG8tSFnnzAEWlob0WjGVc6xmOYnWSCBWkvlBxtlbZwA4tTxguhufgcz" +
                        "kKP99Zly99yz2Db1mTHvDJMurOUpCpOresdESX9UuPkrXwkucpSgrFvoV22ZbKAUnl3N8EORLOX" +
                        "llmZ2IwTuMF89I15Gq5j6UpmJxpWDLunGkEpxc7DPeiVFCct62aZJIs7Casikvni19f36oLIq4m" +
                        "OB+Syt9zqMPP8RwZRnVnLwzHw7npXOIWlN4MDh/umLIcHiaEKKLMq06jz51GlukRK1ez6rGL4hQ" +
                        "taX3n6fVax45dJBi+SRhNGuUFMQ+UKxalJR4ITk0nB89w0BgvcEaLeN2ovLhoPXEE3OU2QAxcqm" +
                        "RIhCPtLvL84Gl099qIigpGAxzlOxqpUR8Ym4Ot3oCP1ISKSGIAJO70cPtJMcOL9Z2/KJ+/FY2sE" +
                        "jZeM74TDRzdE3h2SqkuEqjXtZK5JSpKrRw4lU3fPe9zfa4dyZ/ZOXYntooTh1Gxg2i5jjt9btg9" +
                        "BgDKUTcX13WT5xcpDLlqMAUaAFu+K2HqSgJwQueenoBJQXL/Ryte0rhk6OHD2FWT9JUCtvvc2T1" +
                        "GbOWOj2RQtAYjflgcZWV04Yql0StriryvPXk3qfIh6tnxlWIgEagpWC47BksfWtctRQM0xwlOko" +
                        "pGc2fPs384ATW+1F9UROB8meVuhJYHgqWTgoknn7fEDfHlXeu+fTT+8lXTiO0JEESXGDp5BKLo2" +
                        "VBCEEiaxTp1Lx+RvoeRNxNnzd4Z6amHkli9QuD5YXxzvj0zmRi3ZRAfJo4OZk1QSwNliLEK60xW" +
                        "Zb1CQI6zdZXB/3F749b45cEoouN877VTk6GkHzIe38wafc2HZ8/dXVlovWIILVSSK1CsD44r4Vz" +
                        "TgTvha/ZXsIjgxJaKq2zVrt30jr/xaPLxWsJ0TiSEGkVhJD102OcEyF44dxIEeedkEoFKZKo0Yx" +
                        "WW73JR+aXlx4pM7UjEGKpZIi0JgSCs06MZNrCeyueUZpJoYJWiVBKpc9deR3eS4CX2qr6S6BYWi" +
                        "7S+SWPUjokzc4OF8z4YOmwGx7fMwasPvv965rjxN0p8I7u2jWPDof9m4er7jJQLSGFj6JolFvXT" +
                        "0kK3gvvfV2MeoRUyiuRRI04WWn0Ju48sXh6ryn05kDQSumgI0WwBOut8N4RnBc+uBFlRwYlFEop" +
                        "22x35gPy00cW8tcHH7UQEEUqCCmFr7y33ongkd65WsXoHSgptEhU0owOtnuTjy2uLN9UpGIHyFh" +
                        "IKaJI1w9lsk4670TwPtTX7mpptVBeyUS1k+aJqNH+7LFTJ7dbF80ggnhWTAhb2+MSvA8+OMCr4y" +
                        "sH5Uj6XkxNrzn5dygp1JyCT3sBzfHJKNZxO9gyHxahXGlFdFezEFk3gEC2ME9VlugN4ZFEy0dan" +
                        "c7HqyIb9064ZquVVbnpWx+IdPRn45MzH1dxvKFcnQ9R3HCeELwXQjebUgDGVMI5i5SRNM6Q91ec" +
                        "1o3MWnu01Wq9e3bjtilTDqZFVXkVRcFaJ6ROhE4i4ZzDVJXwzskoaYnB6oLDBemFOEEIy93O+OV" +
                        "Ts+s3ZEun25GOHFJIV4Wgm01Zq38t1lpVC9A1g+XTldYNi+D4cxQUXiKUxOTph5++4xNPB2dm27" +
                        "PbXdIekytH93jvtYzbk7JcOXr6+fLcE/f89Zl/H4Z7r377z76qu2V6U5kudaUPldQaa51XcSOoS" +
                        "Etrragqq7x36LgVBiunrAhKhcBRIB0bn75YJ411+cqpOIoaARFwTgTdbAohkVVppfW126b1PqSr" +
                        "iyHSjbKy9nCn0713ZsNZv+Rs0fZ5FnQcB+9cCDIWuhEL752ojAvOVSKKW2I4WPK+sgIhhyH4vNM" +
                        "ee/3k2vWdfPl0rKQKUkls5dGNlpBaiqqqQmUdhCCkikV/6aRXKgnW2WWtlZ+YWf8JqUXH9JdEFD" +
                        "fwoX78a9RqCEIIprTC+kpolQhPX8g4NmU6rOJmKz+jlHjheOH4X/H4fwYAYkF2Qd5yP1IAAAAAS" +
                        "UVORK5CYII=",

        marker:         "iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAAK3RFWHRDcmVhdGlvbiBUaW1lAHZ" +
                        "yIDE0IGp1bCAyMDA2IDEzOjMxOjIzICswMTAwHvJDZwAAAAd0SU1FB9YHDgsgJYiZ4bUAAAAJcE" +
                        "hZcwAALiIAAC4iAari3ZIAAAAEZ0FNQQAAsY8L/GEFAAAB5ElEQVR42q2Tz0sqURTH72Qq4mASS" +
                        "AoSIfSDdCEI8qJFLXSjLYSQNoGLINrI8/0ZD9q0KnDlKkIMebmP9xZRCEEiLQLBiMiNJDYq/Zg5" +
                        "73vpCkM6CdGBD3Pn3OvXe77nDGPfENKwJBHx/CxYAtNAAVfgXJKk7khVCCyCP6ALVKAJXkEdbIN" +
                        "xw5tgM4HHPphSFEUql8usXq8zWZZZKBRiPp+PH3sBx2Br4FbiBg+aplGxWKRgMPiMH1+YTKZDq9" +
                        "V64na7G+l0mprNJo7RG/g94IEoQSsUCuRyue6QToIJYAJWMA/Bo2QySZ1Ohws9gZBeZI570Gq1y" +
                        "O/395BKGJg+ZbFYznK5HAmf9vQiKW5iqVQim832Fyn5E+83Y7EYieAdY2Nig7dRqtVqrNfr3YiW" +
                        "GsVltVrtr2f0IrwEZrfbGeqWhQ9GMeFwOPprRS9SAWo4HGZOp/MH1l4DAS6+HolE+u9Xek9kcK+" +
                        "qKqVSKUL/s0hPDhFY83g8j5VKhcQg7nxs80/w0mg0KB6Pa2az+RTpDbDA3sd/lwvk8/l+Z7iS/F" +
                        "HEAor8H9rtNmWzWYpGo+T1eikQCFAmkyFxAy7AJ255aMHYcIID8d1oNBi8hGuwwkYFDq0CPlG3Y" +
                        "sTb4B/4BRwjBb4S/wGzT16tu5THiAAAAABJRU5ErkJggg==",

        mask:           "iVBORw0KGgoAAAANSUhEUgAAAGUAAABlCAYAAABUfC3PAAAAB3RJTUUH1gcOCDMLN+YTsQAAB5h" +
                        "JREFUeNrtXdtS5DoMbKkG/v+Lj/cJCgbb6pbkZDjFVFHLxjepWzc7mQD8fV7uY3/6/ClxUg77vx" +
                        "BqLzTXHePtxfpfDkR33yv7XEbIXQKdaLt63vF0vRVHOwjwrv1K0jrHXLFGu5K7PnZw/QyIY9Juh" +
                        "2SR5rUGYKvCsXNW1u7qc8m1x4FEnwHgJGgnyT2i110C2mHln8MTo+fL6HMn+K8CQtRmTxVXZACz" +
                        "sZJMqgVllbVkfwRzKOCOjUyDnNeKxkeNV0i5QqCr16iMt8CAVkZhC6+zXaJXNkV20e8meE0XAaw" +
                        "cLPnOyvA4sE+worcxfTtCY8YT7AC5ppCCjgUKSnauWQHZDhhfmRQjhGXAVIFXCcq0zWQcmz4qUZ" +
                        "bpk9k8mhC6WoRMzJuZ3xa/o3HNFCmVo/yTwL3C3Cfl/PavNVl8l6KWCD2/+d9p21dPWe1Y0bXYi" +
                        "4zNGMpJmbekMEcNDFFXgxj1NaLYsESkOEbWipTnY4cRKFglS0m6Rs7xdcMWXYvasvqk5ngEhKi7" +
                        "WiYEsJZbUXAmjwfXTnhD6pqyeRwFgLqtSSUm8kqFSCOKEqsYWXT2xZbLqidABHpVJXqShKzx7Pq" +
                        "rxkmREuUJVhglpLEbOYWsCCCfkDrLJx6QXwHeMuHLgqPpAe0GmSq8JUOBJyy5IiMKvy/nYcOXEW" +
                        "dZVmjLtLNk7ios35A6854MWer/w0SffQhBATirSAYYhgQjiah6/nKOzOYxKont4mu2yAV3yQTRs" +
                        "IwlJQt+VBicIIQpCjy4ZqIX0vkho5cavlZAg7TijGKZtsp4Fyz8hEF9klJ9Jjg6H1NJtAZSPADI" +
                        "C+SpZElErY5ZmMoJDcn4CkAypLByZjwjlP8RVE2DKAKYHIIDhPhTxZRNrFVSukIvneh3lqAcXUR" +
                        "KQCAOTR7kB8EvkXziwQlmU4hGq0Qxd1R/vq5jDWtJD04McrPInGupIa0KGLNOBtQjhD8IcFQvQh" +
                        "JwNMzR8eNJ8p8JWhHmk3EpTzHSE6rAYqPAKqH7BBRfKHyalIohfOrw2JTDzD5DCWNV0rCI4UqIY" +
                        "az3FHH0fA/BIwB+lw4hjrN7oGjX3WnJfogQZ/B4TLxk9Rh/dCOJ9azo9iube3wXAhYgzOJ+1SM6" +
                        "vcyjkpgpgS1RVVUSOBO6VuRWwMuQlyb8QZSrI7npO1U9uVCOejI0McQ6kbTVOeXN4whOjpWbXOz" +
                        "9+53wECq0CkGzkOei9btC9CNRGTH33tXi4ORxiCfDkieveSEnUaQwXwg1wlOUe+1OHvHsknZHjG" +
                        "f+j4VXeYXYSCEnYy6rgCfBU6xxpwsa54vkczKETXPKY8NsViArAOUNYcQDME7o2REmP/cpb4sJv" +
                        "lo2kmA5WdmolY4TyTmqeCr5pMtApwXKjpTTCRAiMI78fsKJE2EWUE+W0yzZFCkoWsauxMyUlpkS" +
                        "tusYxQtyA8Ixy5sIrrKYB9WSQz+f6iYSjZEAwpq+I+WdqBTQbBWO2jlRdfzqrKxr71KS6cNTKqe" +
                        "a3cfdK4NwoX/3Ka8367fLZ9PwhSZQO4+7M0fvSBDWCXZW3hF5CqNodFSSBQHE+iiQdtdtZTB3Ht" +
                        "8ueOLjlNIZUnARKVb1lOx9afv7absP9PluGIaUqApTLRPEMXsnEHcQwDwXsH3u622SCLEhpbRgc" +
                        "XwHCVUjU7+Ooeaw8ZxTIFYRaHiwQX3CEIm+uMDLup7SnCb6TgXQDACjZDdRmeeinZQXK1LekyGg" +
                        "42sJp772gBuNCcHt6Mj4Pz0Fm8NICMKh4OJVUpD0mm6PRHHt8XGTqwokkmOZUIKCQWTGYnFQquK" +
                        "ALJarkhgE2CiEEzSFIlSUPxAmO0jZHrNAUCirMIiKqnvtjF5ekAObR3RnL0/4kei7Xpcxq0YYUi" +
                        "DKUCUuY+mefEKU9aLl0T2IMIYmN0bB/SEAXvH+jjZ2vWn4QtKaVCWxKRM71gRRWKjzKg8n+uYZu" +
                        "F3bD09BwZI7x1aB73zTEIr6qbJNS+LsQgD/Tq2Ol6Qp45AIfx2GFnnM0lPeEwIpArAvaasAgaIO" +
                        "yhgmBJaurcKXnVxUaLtCHpYIu0jGoeQUFACsEpBp6zQSRW4g90rdo6TgwFzd8172ivREn5AUFBb" +
                        "qBkYNQezYjAwn9R+zRJ+ZGA0gd1lq57wVg8wawNRTugHtAoPNIR3EP3/PcwgGUcUCz/sUkEp3kY" +
                        "IDxtBNvhoxqrJ9C18ZpRlLi8buXH7VfyQUH2KYVoGPchD9NwS+ekrGarqsr9uKM+2jGBa7xnx6S" +
                        "pdiHe27hJn5ixW76536KDLsjGBKCkRXXQHHgMiu29Hvt/z+I3xdBUTX+JUB7Lxr92eumLf9gQyB" +
                        "I6n/t7OvaCDjitgkWKWNIQWFsWzbHWuMZ1Ii5aMKZtdXGYsCAVWgVePceeLIzD8jpcN6hiD4B2H" +
                        "PIScLWAdpp8Ywfab7FHaynWVnBe5U9oQeFZnZa2OW6NUYPogck1EKLzIHG1LbZF55SkWo3zzmFe" +
                        "Tbekpl4ivaT43dATyuwOXr5rEifFTasvPvwt5oIPnufkzfEZES5Q9mwUGWoSDWYOWoAnfnOCp8X" +
                        "SnQyfmsYey4QN+x2qe84sduMIY7PsMA/Ie/z0t9/gHKOXPlZc81WwAAAABJRU5ErkJggg==",

        wheel:          "iVBORw0KGgoAAAANSUhEUgAAAMMAAADDCAYAAAA/f6WqAAAAB3RJTUUH1gcOCDIojJpTggAALYl" +
                        "JREFUeNrtnXmYHUW58H9V1WdmMtlDQtijSSDKorLovRAWAwqyiBJugoCK6CfqRdSLityLkIsiF9" +
                        "SIyqIsRhZBlu+TK0JEQBBFUEAEZQ9LgkCABBPIJJnMdFd9f5wzM2d6qrqr+/SZmUy6nqef06e6z" +
                        "9Ld76/epd6qgrKUpSxlKUtZylKWspSlLGVxF1HeguKLAQmTp0JlOuitQU+BaHJ105NBj4JoDEQK" +
                        "olYwoxAmQtKBxKBYi6ITxWokK1GsQPI6ilcQLEWxjBfpFGDKu13CMBwEXsA2bTB+BzA7Qbgz6B0" +
                        "hmgl6GugxEAG6tkX0va/fr70XBhQgqb72bLb3kgjFy0ieQ/EUiscQPErAo/yNlaL6pWUpYWia8C" +
                        "v4l21BzwYzG6K9IHo7mBarcPcTfG0BwROGNED67xsUy5E8gOSPBNyD5mH+VGqREoaGhX+/KSD3h" +
                        "+j9EL231uILt+AnaYACYcgCiKADxZ+R3IHgNlp4jFvpKuEoYUgBYL8A2mYB80AfDGZXiCp+gu8C" +
                        "wXY8AYaigHABInkJyW+R3Mga7uBu1pZglDDUAJinIJoOZh5ER0L0LjDSLsjaQ9BThN5VlwZDEUD" +
                        "0hwIkK1DcguQ61vN7cTPrShg2Sef3Q+Nh1GGgPwF6X9CV/K2/zghCThgaAUWmOuXLEPwcxZW8wB" +
                        "JxN2EJw4g3g6btCOLTEM0DPdXd6usMTnAW08hxrB4Gl3AH/YR3YF3Pq+08l3YIYucJulH8HskiW" +
                        "rlJXERHCcOIguC4NmjbB6KTQB8EumWgIOuMwp0Vjoww2IAIKN6UkgM0RP37JUguJeBKfshrI923" +
                        "ECMbghPaITgMzMmg31ONBLkEX3uaP41C4DgnDkMQa8HjMKiCwZBOvwIUKxFcTsAFLOQfI7UfQ4x" +
                        "MCL48GsLDgK+A3qNP2NNMH90kCNLMJgcMPj6ELxg2gQ88YOj/ugrJIgQX0MYL4syRBYUYWRCc1A" +
                        "ptBwFngN7dHQnKA4GPo5xUlwJLEgxZBD5wCH1WcylZW6xCcAkB3xdn8koJw7CCYIGEaCcwZ4I+H" +
                        "LRyh0V9Wn2dQ6C1p4lUAAxJgGQxpdIiTK7XvnOXYvgGa7heLGTtxi5HcuMH4VtTQJ4N8o8gjwCh" +
                        "qozXb5KBdSQcc21g/245NO2K628Iy99JuwwRuwyfWyh4CwGL2IxbzDnsba5HlTAMkUlk+NZc0Pe" +
                        "A+BrIsenSkf50/QBwSdww1Pu+ly499utva/9z9kNwGy/wPfNttihhGDQIEIZzt4dtLgd5Pcgdsk" +
                        "GQZ8Mi/Hm+owmCPRSbDRbJKARfoMI95gfMNwtoK2Form/QBucdD8EfQH4EpHILv3S85tEOvsJdM" +
                        "BhZv6Z5gu7WEvE2SDEDyTVswU/NhWxbwtAUEH6wDUy+FOSlIKfadLW/VpANCn+jrX9B5lWjFl6W" +
                        "WyQTXgfWKeAjVLjL/ITDzAKCEoZCIJinDD/+AAR3gvgoSJluFskM2sH2HUU1szmBSPu478/JDIK" +
                        "fdgvTbqe0tkkzENzAWznHXMTEEoaGQLi4HQ78Ksj/C2p71x3P1pTZzofGfQhvqTZAN9AJrK1tbw" +
                        "JravvrgK5azNX9dUWYSdIRQUozh4SHU913bhuSLzOGX5irmDXc4w3DFISfbgFiIURHV9MojKW/Q" +
                        "JPcsZanL8GzX8C5hRFE6yFcD3otRMsgeh7ClyH8J4SrIHoD9Bro6qyez3qgQkArCoVkDAHjUYwn" +
                        "YBIBUwiYRsAMFJuhaEPRTkCFAJHYv5Clv6K+r0KSrWNOpuz3ZMbC51DcJuZbYC9hsIFwza6gL4N" +
                        "oN7fw+/QupwHQQCdZddMQroNoNURPQPgg6Ceg+3nQS+GZ5YJiH7qZzngqbIdkOhVmongHinejmE" +
                        "rAWAIquTvusiT3JeUyJQPSAfw3a7hQHE9nCYM7WiRh54MgvAz0VunCn0cz5Emr6N0MhJ0QrYDof" +
                        "tB3QfgIrH9M8MjqIbtv+xHQxUwUO6PYE8X+KKahGEeAStQasgEgkjTDQK1QX6cRXIThdHEEq0sY" +
                        "BoDwYAWWfRKib4MZlw5AxEDTqdG0bBcA0TqIXoDoFtC/gbV/EdyzatiamPsRUOHtVJhNhblI3oV" +
                        "iEgHKy4RKy4LtEe7AA4Iks0lwM4bPig/yUglDLwg3tYM+tbZV0k2jpHyjJCiSxigPgKATwuerAE" +
                        "S3QHS/4OaNblikAcFcZqI4AMlcAnZHMYGgFgBNM5V8/Qfbe5noP/TUP4Tgo+JAntjkYTDcNQY6z" +
                        "gZ9YnXscSMQZMlGtYKgQa+E6G4Ir4aOOwU3rWGEFAOSY9iJVo5EMg/FTBQtmf0IHxCUFwg9GmIJ" +
                        "AUeJ9/LXTRYGw+3jofs8MJ/oP/CmZzMeplIaCF7aIaqZQdfChqsEVz3BCC/mWMYxhkNRnIDi3QS" +
                        "0o2qRKVfqt8wAhy8Q9ZEmwTHsx31DNaJODB0It04C9SPQ8/3MoiwOs7dmiEA/B9Fl0HWV4JLlbG" +
                        "LFzKOFrZiD4osE7ItktNOx9knz9neibdtyJB9nL347FECIoQHh9vGgLqmCYAoEwXuEmga9DKJFs" +
                        "P4ywUWvsIkXcwIVJvF+JCfXIlLtmUFQHjCkA/EaAUeKPbhnxMNg+NM46Dof9Mft5lBen8ErgmQg" +
                        "ehX05dB5keB7/6As/Z/PSbQynkNp4atIdkfV9Vv4hliTzKN0cwkEL6GYL3bj3hELg+E3o2H098C" +
                        "cMBAA4wGAacA8CteCvhHEtwVn/L0U+5Rn9TXGM4GPIjkZyVt7e7obgcEHhD4gliGZK97JQyMOhm" +
                        "o/QvhNMKf0OcvGA4asKRgDHGZd7RXWC6Dzl4Izw1LUMzy3bzMDxQICjkTRnjjnUp6+BjsIPftP0" +
                        "8LBYhbPjRgYqj3LH/wcmO+DDuwANAKDE4Q3wFwF684RfP2lUrRzPr+LqbCBuSjOQPE2VK2PwqdH" +
                        "Oq926APiHhRzxQ6s2OhhqE7l+JcPgrgazJhk08jk1AoDHGYN0eNVLfT6bwRnlusVFPEsz2crWvg" +
                        "GAcegGOXVz5A9olSVStUPiJ8zhk+LLZs76cAgwPD4bhAthmiqn5/gA0RSx1vYCdENoE8TnFg6yM" +
                        "3QEq18FMkCJNv19k34RpOy+A19GsIgOJdlnC7mNG8OWNFcEJ6dCht+DXpXf7PIBwhnROk10N+As" +
                        "ZcK5neVotvEZ3s576CFHxKwNxLlBUNWEPqbSxsQfIptuUaI5vRBiOaB8GA7jF0E+qg+4faFISsQ" +
                        "kQH9GIRfEHzirlJUBwmIq5lMC2ehOA5FW2KOUh4QBg4tXYnkELEVDzTjemRzQDASJn4J5Dz7lam" +
                        "MdyHxPA3yTlAfLkEY3CKOZSUv80UkZyB5I5ew26fHt4OkmIzgJ+bV5kxH06Rhny8cAPK06nhlm1" +
                        "clPO6KV1MSgrwO5NGCo58txXMIgPgiG/grCxGchOTV1MemUh6zcoLQE87dBcV3jaFl2JtJhqVbg" +
                        "rwLzCy3aZSlw81pGnXXcopOEczvKMVyGJhNt3EIkh+j2DZRoPOYSf3NpYiAzzCORUXmMMliQTAV" +
                        "qJwLalZygFmQX59KQG4AdR50fbkEYRhpiQNZjORjSJ5FYgqNLPUXJYXgf1jDTsPYTHrtGFBHu+c" +
                        "OSRsB4nVX1oH4FnScLpi/vhTBYQbE/tyN4WgUj6NiQLh6q33Npv7t6RQCLjCG0cPOTDL8cxroe6" +
                        "tjl02CWZQUUTIpppHeANHZIM4WzCnTKoazyXQ/uyK4DslMJKKBHuiBnXD9X79Che8VEW4VxYBgA" +
                        "lh9OZhj7RAYTxCiBP8h6gJzLrx8Vk8fgjGm7FkeIgXgPCBE7zHzAO8h4OcopjtGuKXHVUTKvmAV" +
                        "itlCND5stCAY3vww6BuAYKDwpznNPs6zCUFfDOu+IpjTO72IMaZrOFz/EP32UH7eCwYA8zD7U+F" +
                        "qJFvk6ltwOdK1VyPACBZLmCsEG4ZUGAxvbAbqPjDb24U/i3awwRLpaup15/GCvfuNRzbGrB3Eax" +
                        "cFnCMG+f8U9d+8/3scBgDzGEehuATFuLpVRf1iKo75XI3oe9WgNRzfKrhyyGAwGAFd3wR9mlsT2" +
                        "LSEC4q4mRSZ6voL+kjBbgOyFo0xqxoQNNEEYRVDCEqzrj9TnRUGEDzDSQjO7ddT7asZ7NogLllL" +
                        "u+A940T+7NYGYejcEeR91XmOkkwjHy1h1Q7PAIcKdnza+vvGrMhwTWIQIRGD9Ps+5zb7+0TMTJL" +
                        "2Z0XAUhYScGJvLpMtUzVhlu8ebaCFs4n9zhj4Wl5nWuQHwQTA9aCPSIYgyTxKNJlWgT5G8LZbnf" +
                        "/BmJcyPsyGH3ZOYRMb0ffn+S6RBgOAWck4urgBwfv7RZg8zCPTZxINkKq6/Y4QZk8S/G1QYejGH" +
                        "CzhJoEJql+SVytY07i7QP8nzDgvqYfRGLM06cEU8XBzfGeW80WD/6VZv5P7s0kwAJgXmEkri1Fs" +
                        "7wVB7dvi2iDBAP/VJDhCiOxz3IqcWqHSBXdK2Lsn3bz6ZYb8TrSp9xOuh67jBDskRgeMMUsyCE8" +
                        "RIOQVHFHQ8WYJtiiqLg0GAPMah1LhWiRjXH5CzEFOBaFOokIFcyaJ7LNr5IKhE3OogZskyP5T9Z" +
                        "ve1+waofczS2D9+wQzXki9qcY8nvGBNyqAIid8RQleoYLr8epzLDsMBsEazkVwci21YgAIBn8QL" +
                        "FAsngqHZ9UOIo9WWAt3ippWsK9lUa8pMmmItaCPFWzxS6//YswjOYRBDJJgFfm5Is91fdanEUl6" +
                        "9YYBwKxiAi3cgmLPHv/B5SBnAaFWFxrYf2vBH7LIdua1tt6EA4G96gEwdSBU90Vd0pOqQVF/po6" +
                        "9CqqhYnE5XPirTK5L9pasaIHJKrB5fyuPgMbPNY738f363zEpdfWf92+FJ7LarOVkJL9GMdFYTK" +
                        "KsENTVBxr+0xj+KAS6KZrBYNQquF3AHJ8lhWXMfErWCtHTEOwnGOM9u50x5r6M2iDPa14zwxe0P" +
                        "N8lMv5n399Nq3Mdr3egMy2MbgxnaTjVgGoEBEtdGMLsGYL7m6IZVsBeAvZ1aYX6OtnvmKgBIeu0" +
                        "RD+tsAHU1wXtWad57M7Q0mcRwqyCluXz3oLlccz3901KnU+jaSz31hQQmfyuhkM07OobezR+YAT" +
                        "AfxjDMb79Dt4wLMBIAyebatcIWACoh8JlOonavug7y4BcDC035orwNi6kaQLrC1bS7+eBQWT8ft" +
                        "t7E9tPOm6DxniYTA0VIVjdaTjDwPUaRukcELhMJgMffgpmAU8WaiYtx+xk4CEBLVmWDXavvdnrZ" +
                        "P8T5P4C8UhmZ96YW5uh6nEvKisyAiRShDftu/N+n0i5bt/PCs//Vu9Aq+zPEdUB1xo4Uldbx8Tw" +
                        "qQcEvceBC94mOKlQzRDCcS4Q4k2MTNAUfa8CAVohFuUBIaYZsgp9ViH0FTAfOLK+9xXGrIIsPZz" +
                        "jNIe5kKxfIYjWGM6MYH8NkzxCp17mUm37yNOG03YQvFkIDC9h2rvhWN81to0HJLXXVzfADxq4j9" +
                        "05W/9mtqJ5W9ws/62+Tub8j9oRZRIpPoMrgtQQGGMFj64wXGPgRBPTDnm0Qt02eT0cAVyR9h+8Y" +
                        "sKdVQdnqyyrISettRlVNY0O4ZLRiBcbhCFtCxPeh3Vbt2PftnUn1MUuc0Bd5FnnM0OCsfVaWupM" +
                        "hjrXhuUVhzOdq2j4voaVPstP+ixNWXdxn1xg0mU9lWaDEc/AzQIOyboAfXK4lZcE7DYW8Vrem2e" +
                        "M+VmDtrpPnSiotZc5fzvtPJnhs83aeq8tj8/QzwoxLNTwHz3awaYRyKYZalY+79xN8HhDZtKTsK" +
                        "WAA7LecekwnUxfJ+MVExsAoVa6ChTWLALo+9n649rzvKy32uQUXhP7vUb6pgrzH9bDjyvwSQMTs" +
                        "oRUiYFC/+OBgY8AZzRkJkUwV0OrzzKBOkF9xepWGbikgHvXnWNLM3fClM/4mlKhxUxy1UU5N98p" +
                        "yxOTwVLMpbgJFD9WqKk0U7Akgv8XgklamNhncYLYNv96g8qtGQxGPArzohzOsnBrBiPguimIZQX" +
                        "AEGYMS+Zp/X1b86Tv0I46mxbQHorWdcttXUDxvlBivyFjTrUcaMoPiDzFHehCx5ILuEDDRzSMzu" +
                        "EwD6C49vkdtoJdgQdzwfAIvEXAnjQgMZantl7CTwu6b90Z4+CNCr/M4A+k1aWZTtKjnZEOgdcOv" +
                        "0J71NmAMI4IeVNMpbfAI0/CHzUcaHJA4NgEcFRuGCI4TEDFN/aX9LTqDNS/bE1h63R1eQiqLxTS" +
                        "47hO+WzSucIhpGk2vchwjsvfMAxMLtYJmiEOhImBEBd+U6R2EALzqOEKA3M0VBqBIGbXfcgYTnG" +
                        "lZyTAYISBg4yj6ZUWMGwSEXtaoYFFAqEL1AxZW+8iIi8yQ4svE0wXFxw6BRjpMImwdO2kQU0KEM" +
                        "LiI8TrmjHlzk0hvGxgWh4AtCUWbGDGHbA98HQmGB6EURHs49IEJqWu3siseyKvATcWeMO6M9jwP" +
                        "nUyIxB4tPARfhkrLnPIODSCsfgCBnvOpIx1ssXNJCyaAIcTLYrWBLays6DjL4ZrIjiVujBr1s6Q" +
                        "2DGp4f2ZYeiCvYBxcS3gep8ERt3+r3dAvFHgPQubHGOXnsddLbm27MuYA+0j+PH38dBo/HbLmBY" +
                        "wlscU1xRxhU6d7yoHwzyymOk3aviSgVG+ppAjtFoPyYHAhZlgiOB9OLSASdEIWJ4w0CXgfwu+X1" +
                        "2DJPhJpk7asA6RAIF2QCUTQLAlBUsGZs9Lh2kUb8fiZpELgDgEJmYuFQ7GUnhoK3gW2NnDH3Bpg" +
                        "/j+fosNrYdYZt8LXP5CBPvkyTwz7qZ6JVD0yjrdBdr5WTSCfbRr8nHtcaxeqHVCJ5kruiMtoU8b" +
                        "FDJmHtnqfGWsaZphviD6g+EXGnbq6ZHGw0ewmUx1x8dreBfwZy8YfgPtGnbzScK33X2Hl7p4d8T" +
                        "aYQCDSGjls9S5nF9bK+8KXwrHvq7TDjZzxWYyxf2GtDoXEMbS2rvqbB1yhZYQfmXgq9TGOvjAQL" +
                        "p22NsbBgF7aGhzAeBrMtVHkTTc0YTGo5viHN1GWn7XexcIwmLX21p9bdEA2qEdbEJvYvuqTm6wd" +
                        "NTVD04nBqgLCNFkLfFwBK8Ab9X+plCaQz0bWBj/IVc6xt6+XeEJ3d/1+QbrgN81CQafbFVbmoUt" +
                        "/SIpJSNL+kVaykZStmpIcpqGLRlYk57x6lp02zXs2KfjtynaoL7MEYQh3OFzM9Lq627WXrYs1sC" +
                        "hmt5ta/mT6lL8i0dnI14dIs2Q1fzx0R6S9AF9OsEk0rFzjeO4TQu4Wn1jCY/aepJtDaC0aAzfKG" +
                        "bTp/XX8DsDx9fGNXs50ZCYXLX5DJgGPJ8CgxEadrGZRXFV4vIbLHD8sUn3qSgYpKf5IzPAIRMAS" +
                        "1q+Ly26Y1KO9dQpiwAnJWbGv98XjKZrhxDuN9XIYeDjJJMCRrWTm11SYVgMY7urOUkDhD5tigTH" +
                        "FBKhhD81EYYsznCaRiAmnHgKc2Spiwusy4GWFqfZJuz1Ah73H+LPXaaYwRY3sZ+fEAfL1gs9KCA" +
                        "AHA7P/gKWAzOSWn0PjVD/fhfgpkQYumFHXXcT07SCSIFBQOf6hOSogmDI6+SKlNbbt+X3eXUtyJ" +
                        "TU0tvMJOlwklXsNa01t2mGJCjSvqdpUAiBud5wXxyGJMHXjj9WV79zqs/QBbu4Jh8yDhhSzKkXD" +
                        "od/DLKZJGksWlSE8MsEPyIu7PHlOXQCLEmmT1aNYNMOtkiWtsDBYJpLEdwr4JiehjpN8E1CzLd2" +
                        "MekwGNhe4zcHYhIMddri73X9JUMBQ5L5k0X4XX6AzZySHr6By0ewQSBJnxVFZdQEceWuU4AwGeS" +
                        "t8GLgqbAaYWvJoQUG/LkQZi4wyDPrpp8MLM7KdNdIDiyhA+k4Vvu8MSSPOx0EMylJ+NPMpEY1RB" +
                        "oItgVeXVDUH7OdB96ZzE67P2lGwqwTBBStGZ6Oqs/bG4YUWtu2hq2AF50waJhuPIWfBGh07zX4z" +
                        "WaWs3Q5hNRX+Mkh8FkiQ2mtv80kskWNkjrS6h+FItuQTNss0EkAJGmKppaPwUs/gVVQXQTdVz3p" +
                        "hJsgYXoiDBFMT1oYIGl+QYs5FZpY+KoJmsFX+H3Mn0Yd4qSl+RTJS3271rGJawRXNoJ0+JQueUl" +
                        "acUg6zCWRYno1rwhMZFgCbJOh9U/09HUVht9bYfgpZoKGcSIh3ECC1rDMQBUKeKGJtygkexKdzO" +
                        "EwZzWFbFBoS51J0BhJGkHG4LBFler3SXhUrnTzeJdRnghV0Z1vzxmYYzyFPUkl1gh/i9OB7obNl" +
                        "aNHsSeYnhGGtR9vTs9zWj9DHi2RxfxpxDeIw5CkGWy+gcrQ+vtGkbAIvw8Ag6ohwioM/Xq9jR0a" +
                        "LxvRwBQnDBo2czUhUcpdtMFgmhdSTfIZfNIlmgmDzFCXpBHix5VFOxiHlqjvc3A5uq7Hlzbm2qS" +
                        "Ee5vZ8r0o+oIJia2+cUel6vc3S4Jhiklu6Z130mZKGXi9yTB0F+An5DGRfPyEtDqfTVn6FOJ1Pm" +
                        "aRSdEMPhDYhH9Qi4FV2gMGl3awhNDcmiGEKfEBtFlAIBaSYOhgyGMa5QmRpqxl3/BmUuqUBYI0c" +
                        "8k42jkXCPFxGTLFRGvmw14t6uTcpAh82p/SSTAIGOPzJcLjeA2mfzbfjMzkM8iMmsKnTnn6DMpy" +
                        "XFmO+8IQd55VgqaoN5mIWb1xS9g2e0fS4J9BC7GGsEp6wpCmHWplTJJmaBd+Qu7llQ0CDF0ZQqZ" +
                        "JHWl5o0eupDtf/yAeMq2HQqXAYNMIqgEHuh4KYemDiHcADnrnWxesrtRk3PeHUhr3dicMUW0xEt" +
                        "edynqlBlYPIzMpr/BnjRjZWvk0bRDV7RuH8yxjEOAAIwkSm0kU1WkL11iMLDO0NLO8GTb4OzEbs" +
                        "tUJgwEV75ExBf3wRghDI0BozwhRvIdZxLSFzVwyjqhSHJKefeVW3APg0HVQRHV19Vt8xr1B8xnW" +
                        "gWmluNFEJnZv4tGksUX2kWhYOwxgaDSvKClalOQfiDqhttW5IDEOAJKiS1giTGmCqiymURIIrmG" +
                        "gg1baYW036AK/MtFnKKwIiv3X1t8Q1WkqjTHC0cq6Jgo3jtbYNnAm3hoL0meOiMcZXIm9NoESOb" +
                        "p00pa50ikhU+FpGhEDgsEGImrid8d9ho4Cv1tSS6rayMugjPMti5eZNNrkG6vhKmuSzKRQDAXuZ" +
                        "SmLR+kEERT0XcISfY3D0FWUM1w7f0L5CMtSYBnXXR3Mn1lVO2zPDUkwrDN+Qp56Tm2bVD6/shQY" +
                        "LZkga2aSaACCumPrUn2GRoCIeYQlDGUprIQwUYIUHoIO9lXfY7La4YQhhBW+wWPjAYOwZMGWpSw" +
                        "NRDImRHUwJAFhG3IQ1xgGVjhhMLAi/gU6Iwyx8aglDGUprGiYSCyaJNyC7mM2rUjyGV7Pkh/uMc" +
                        "Ru2/IRlqWo0gXbKA8YpKf/EB9iIGM+w2tR3fq78Vlssy5MHMLoT2Gmlo+xLAVphukhiLwLZlvqV" +
                        "jhh+AFitYY3fRahTlsgvbYFErYrH2NZCnKgp4f5hH7Ae1PdX5qoUSJ4rj4RxWf6b9vc6rX9IIS3" +
                        "lo+xLAV4z6Jngrs0INJAqJua/jmnz0DfCbu6/ACT7DDH/QcFvK18kmVptHwAtg5hou/M8Lb38c4" +
                        "65QNDmmOcYWo/AexYPsqyNFoE7BBCRVqE3DXLQdLMkEDnLHg5EYYIluTQAE5IDOwCRjRxvtWybB" +
                        "JWErM0BMYTBkHyFKkCnqmfZ9XlM/zdZmuZDL5DbNvusDLEWpbGI0l7hSDzLGOlLT5DCI/Gf8M28" +
                        "fDjom4kU5oWSBsIq6EtgD1o7sx6ZRnhznMEe9q0QNos8HFtIfrkcgAMAzTD1bBGw1JfLZAUau2J" +
                        "KEXwr+UTLUvesi/MDGHLyDOSpD00h4G/p2oGEEZj/m5is3H7agTHvIezy0dalrwlgncLaPFYO3C" +
                        "ABnDUmdACg3T8+AO2tVKT1lpN6X/Yef+yJ7os+WF4r65aGF5ZETZZjdW9djss84KhG+7J28XtOK" +
                        "9dwHvLx1qWHP5CEMH7fHqeM6QN3YsYmINqhWEtPKih00VXGomWLdDwvvLJliVr2RXeFcEWEf5aw" +
                        "OXL1smndSlmKwy3w7oIHtIeP5ghxHrIOzCjy8dbliwlhA9G0JY3Mc8GRwj3eMNQdaL5g2/Sk6c3" +
                        "P3k0zCkfb1kymEhKw9zIkqmqM8hkTDu88Qo8nAEGCOGOPFohwZxq0fDh8gmXxbfsALtpmOHrC6T" +
                        "JaO393c+I/hMBpMKwEu4Na+ncOoXKDI7LwbtjxpePuSw+RcMRcRMpTdZ0SuPcDbe5fs8Jw19gvY" +
                        "Y/pNlfaZGlWBRg8xCOKB9zWdLKFMOYCI6JEgbzJDXEDi2hu+D2zDCAMBH8JgsAOj36FETwKTCyf" +
                        "NxlSSqtcHgEW2VxmD3k89m/1RJRM8IAGm7W0K09QlgZPP3dZsFu5eMuS4LjLDQcF0El7xBPW8Mc" +
                        "wi8R7klfEmH4AywN4b5GQqqWPzVKw/HlEy+L00SCd4YwO0tOXJK5VNuMgeuSfjfFXBFGww05+hS" +
                        "SHBsRwVFvwUwrH3tZbCWEz2to90nP9oGkduzpR+GvDcAAG+AXEWxw+QRpuUsOWidqOKF87GWJl7" +
                        "GG7Q0cmda3kLUhDuF6RPKM9qkw/BWWR/Bbn8hRBnNKRnDcVMzm5eMvS393gc9GMD7J1HbJXEJiX" +
                        "mjg2rTf9ojqCKPhp0k/6mO3Weq2BP69fPxl6Y0gGWaE8DENIq1T1wWItoNy7zPwZAEwwKuwOISX" +
                        "fbSDT1Jf7ZjUcMIkzDalGJSl5it8ScPkLAN1fML7ISyyZanmgmE5Yp2Gq3WCNvDJUbJc2FQNXyz" +
                        "FoCwYdtaxTra0ccyefWAr18KNPn9B+v9XroigK01FaT8I6n2HT7Zj3llKwyYNggKxwMDEPONmUh" +
                        "roa/8peLNQGJ6AJzQsTnJefHunLZGlBWCCUio21aIOBnUoKEHNntGe1oUmscOtsxsu9P0XGdIih" +
                        "I5gYQRRXtPIEXUSGg5RZc7SpqoVJkDlG6BG1a8KbGpQRBmgsIDxv6/DU02AAZ6D+wz83icnJCkc" +
                        "ZoGj1cBZYLYopWNTK2O/AuodVQjiW34oNITdcF5S+kVDMICIumGhri547kWo9gREw0wEXy+T+DY" +
                        "lrTD2X0D9OyhVD8DANePFgImw00x0Dbe/CQ9m+TuZBe8luE3DvQlEeneU9E4PLgCFRPEJWvhgKS" +
                        "WbAgjjJ0Dr90BN6A9B0tYfioSGOOyC//EJpzYEA4juLjgnimmHtE4Q2zFDrCFQjEbxHdpMuabDy" +
                        "PYTBIz6L1D/Ul2izaUVlONV9E536rBEbuuEe7P+rVwmyco67ZBmFrmAQFiuu7rNpMK3wbSWUjNS" +
                        "y9aHgPpcn3kkGQiESgGiCoVF3sKoqhWiQYEBRHcEZ2sIPXNDel+NsFxb/2sXKI5gIp+vnV2WEaU" +
                        "VtpkJwXmgxgzUADIHEH1Q1GRscQj35flruZ3VVXB7BL/yBaFXG7iut399CwGnMYWDSukZSSDMHA" +
                        "ejLoRg5sBWUGY0ldQALWGgw8DpebRCQzCACDV8vX4NOBcIA7SBdJpI9dtEAs5nK7NDKUUjwk8II" +
                        "PgmyAP6/ATpEGwfEGzniB9hmUN1EGCADngihPNdDnSvg5x0HQp3IxEwg4DL2MJMKaVpY3eYdzkR" +
                        "1Akglbt1lwnvU02lpWC+k6VfoVAYQJgNcF4ES5wmkXQArxLuRX//YTaj+RGzzNhSqjbWsut8kN8" +
                        "A1ebWCK79JEHq/R4NagGi/1K2gwwDgHhdwyk9znSiNvABYOB9kUg+BJzDNNNWCtbGphXesz+o70" +
                        "MwLtlOTmo1U0Ott0LndQ1LckFXHACXIzi2F2TXqxwQCPAAH5B0ITmXiLN4XHSVUrYxgPCv7wHxc" +
                        "9DTk3NLezbj2K9/b2L7ehVEsxEdTzT6dwtKfRAhcBqSl1Odf5ViMrn8CEULklNo49Qyw3VjAGHf" +
                        "XaHyM1Bvdbf8MqN2sGkJvgUdTxYixYXegIo5DsllCIIBrb5oSCvUb+tQnMMazi01xHAF4YB3g74" +
                        "czNtBC/dQMJOiHVzaovf1blhxKIK1ww8GTIVWfoLiY06hrzebVAoc7kDDBiQ/IOK/+ZNYX0rfcA" +
                        "LhA/uB/gmY6RAJP/PIx1SKgxCtAPZHvPpoUX+9+B7edrMlkruQzLICIHNuAzVlN4pL0XyNu0VHK" +
                        "YXDAYRDDwF+DHpbv6kj8voMOoLoM7B8USOh1Cb5DHVlnViO5CQk65w97Ao/MzKpj0JSQXICLVzC" +
                        "B8p+iKGFAImZ+zGoLAK1rZ8vkGYPi6Rj18Lyq4oEoTmaoXp3JJM4Fck3kUjvaJJKMKHc7zWKu9B" +
                        "8hlvFs6VkDrpZ1ArjvwD6NIjGJw/Vr2/lXT6DTvIRAP13iA5ELHul6EtpYiKcaWdzfoLkI4l+gf" +
                        "BsQJL7JgySxwj4Ar8Qd5USOlggHD0Z1FkQHgemLXlmrSjFUfYymVZCeAji+QeacTnNzQrd3ExF8" +
                        "WsUu2aKIPmAYDefXkPyDeBSbigjTc0F4VPvgOiHoPeGSPkBkAWIATBsAP0peOqaos2jwYEBYEuz" +
                        "GwGLUUzNBYMrf8vdMdmJ4gYqnMbl4h+l1BYNwQkV4KNgFkC0XTV0GnkKvy8QA+oMROfCE6cjCJt" +
                        "1ac0fb7ycvwInIOjI5E8lgZD8mTYkx2JYzPHm4HJMdZEgnLgVVH4E6kKQ06rZp42qea8OqGuhcl" +
                        "YzQRgczdDjUM/gc0i+j6x1yCkPLZElodFuOr1BwFUYzuFi8VIpzY1ogzFzITod9NtBS/c8FT7h1" +
                        "DTtUP8+ugfMXMTDK5p9mYM4ksxUmMU3UZyCROTqgfaBYWDqh0bxBJIFPMIvuVuEpXRneWxfmQFq" +
                        "AegjIWpPXrfJd1pqb4f5adAHIx58bjAudXCHVU41o5nMQhSfyeQ7pCU7puVBVffXIrkRwXf4rvh" +
                        "bKeVpEHxtPLR+FPTJEL21rzc5bUFknxU80mDQgFkGG+Yi/vLQYF3y4I8xnmnGMZrzkXy8KTAkga" +
                        "EwKF5FcgVwId8qHeyBEPygFToOheiroHcHXUmd8N1r33iYT72pFi9CdBTivnsH89KHZsD97mY8c" +
                        "AmS+Q050T6v9jEjmoBlKBbRymWcIl4pIbi4Ah3vh+hkiPasmkQ+k/7oHBoicXsNuo9E/PGewb4F" +
                        "Qzf7xI5mEmP4ESoBCIV/eobKAEPfFqF4DsllGH7G18TLmx4EC1pg8hzQXwS9L0Sjk9dj8lkZPC8" +
                        "I0XKIPga/u7NZfQnDE4YeDdHK91Ac3+tUZ8tPyqYVJBBYz4kI+AeKa5FcyYniiZEPwcXjQR4K0Q" +
                        "mg96g5xyLdJEozl9I63FwdbdEyMMcgbrt3qG7J0M9LtJ8Zg+FsJCfWhnjm8x3ShtbWw+AaVBSgk" +
                        "byO4ncEXI3mTv6PWDOCtICE7XcCcySE80HPgKjFb7W+PP5CUii1X27SEgiPQtz616G8PcNjkq7d" +
                        "TTvjORXJqSgqDadlpDvS/evsgHQS8DyKW2jhFlq5n8PFuo0PAAT8aiZ0HwDhXAh3Bz0BIpm+IJS" +
                        "Pv5AlH8m6PQTRsYibnxzqWzV8Zqzb3VSYxCeRfJuAcdbsVd/UjCwgpG8GxToULxBwCxVuw/Agh4" +
                        "lVwxeAuwII3w7de4M+AqJ3gZ4EofJbB8d3xbQsZpJthFt0M2z4LOKWYdEhOsymbzSSgzkIyWUot" +
                        "vLWCD490kEKIGlb0AtGJ4oVVHgAyV0EPIzgcfYZQjjMXQGMnQnrdwG9J0RzQE+DaFwVgKzLimfR" +
                        "CLk62zToi8B8HXHDG8NF+obnXKaHm10RXIZit960DZXDf0gPsbocahsItjpd0xpvEPAEAQ8geBL" +
                        "Jc7SzlO1ZjhBRsYL/7HhgO+icDnp7CN8B+t0Qbg7hWIgq/QU1xHsxYnyXFvTRDM76DogWwMsXIe" +
                        "7uHE5iN3wn9j3EbMEoFqI4ul+kKW9vdJpjbRN86YAhSAQmQtFJhXW1Xu9lKJ6nhZeR/JOAVSjeo" +
                        "MIaJJ0ERFRYD90VoLWaDt01ttqqMx7CSRBOgXAaRDMg2gx0G4TtNcEX/YU6JB8MWcOoefoVomXQ" +
                        "/Tnovg1xQzTcRG54z3J9mGlnNCchOR3F6NwzEPoAoRJ8i8BTawQJwFToW5kpIKyFc6PauRFSi5p" +
                        "TK6A7AK2qYEQJQu1zLKtfkBY9ytvrHP2u6h9c/dRwFbfhnd58s1iH5rso/g3BEufEAj4Tl9XXxe" +
                        "tdm8859ZuruRH93guggqANwWgEo4FxwFhgNNAOoqWGTsIX2Y75bDLjcdeNTdvvPb8TxELonDucQ" +
                        "Rj+MADcICJ+Jm5Fsz+CnyHQqc8r6bnLjLLhC4DrOwtX2PEfLwqSLDcnDYLeumdBzoOnTkVcs2q4" +
                        "i9rGM/DlavEihk8j+TSCV1PHhAjPBi1N0PPIkI+si0aAiJ+T96JkxgtMaoX6HYuqM1hEcxAX3oy" +
                        "4e6NIm9+4RoFdITq5lJ8C+yC4FkHopamFBxBpWiSTICfIrMj6wSwfEgVtPjfK2co8A+IYWH084k" +
                        "cbVVbwRjgkUhguFktQfALDUcDTTm2Q10zOoiFkgq8hizCZ6h+Va8ur2ijoJklArgfxQzD7IBZej" +
                        "7iic2OTrI13fPD5YgMXiF8QsTdwLoI1drO1yT7C8G44CtYYTrV7N5gD4ZmTEd/daNPhN/7B8ueL" +
                        "FYzmv4DZtZFsUaYGrSi/YVgIfpKN53uhMov2WArmk9BxKOJb9wzHvoOR08+QtZxkWpnAgQScgWS" +
                        "P1MxWnzEPPkl+efKeBnwuS85QWkeZz3FXz7JXZ9oqiC6B6DzEaa+OFPEZmUvLftmMZhKHIvkqkj" +
                        "1S0zTyJPVlzW+SRcGgyZdg10iaRVQHgV4E0fnQ8Q/EmXokic3IXmd5gWlnFIdR4WQk70HV0jp8Y" +
                        "ZAFgWFLEvSGIQ0Cn9Zfe9QlQrASwsthwwUjEYJNA4Y+KNqYyD4oTkJyUG0VIP90jaxp4ElawAmU" +
                        "T1pEoxAknWeFYQmYS2HdlfDF1xDCjGQx2TRg6IMiYHN2pMKngXkETE1cilfGWnJJtoFCSblNMg0" +
                        "G3YAfkPZdtvN684i6Qd9dNYc6foX4/Caz9sWmBUNvMYLzGM84DiPgEyj27R1h55vlakv/lp5aIB" +
                        "WGNBB8tUgmv2AZRD8HcSU8uQRx5iY32domCkNdud4oupmOZB6KI1G8C4nM5UNk9SlkVhiS6vOkY" +
                        "EcrILoFzHVQ+T3i8HWbsiiUMNSXu0zASmZR4d+QHFwbXFTJPAVNnjqpG2z5faZ7jAD9IoR3grkR" +
                        "1t4B89aOdF+ghKFhS8pIbmIKo9gfwfuRzEExDYXIPGCoKTB4j0/ugOjPYG6H7ttg1WMwv3so5iU" +
                        "qYRhJ5tQUtqXCbCSzUeyF5O0oWgoBIhEG7esgG9DLQd8P0b1g7oHoYdizs2z9SxiaqTkES2llFb" +
                        "NQ7ETAzkh2RDKzpkHGZAJEag8N0HssAv0yRM+Bfgq6HwPzKISPwo0rR2o/QAnDxmpiLWMqMJ1Wt" +
                        "gamoJiMYjKSyQSMQjIGhULQhqINpaPqYHltIFoLUSdEq6sdXtEK0K9D9AqYpRAtQ2xXrn9dlrKU" +
                        "pSxlKUtZylKWwSj/HyHl/ePsagXCAAAAAElFTkSuQmCC",

        'Ambrosia':     "/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAVQAA/+4ADkFkb2JlAGTAAAAAAf/" +
                        "bAIQAAgEBAQEBAgEBAgMCAQIDAwICAgIDAwMDAwMDAwQDBAQEBAMEBAUGBgYFBAcHCAgHBwoKCg" +
                        "oKDAwMDAwMDAwMDAECAgIEAwQHBAQHCggHCAoMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD" +
                        "AwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAFgAWAwERAAIRAQMRAf/EAIQAAQADAQAAAAAAAAAA" +
                        "AAAAAAgFBgcJAQEBAQAAAAAAAAAAAAAAAAAGBwUQAAEEAQMCBAQHAAAAAAAAAAIBAwQFBhESBxM" +
                        "IACExCXEjFBZBUYEiMhUYEQABAgMFBwEJAAAAAAAAAAABEQIAAwQxQVESBfAhYYHBEwYikaGx0e" +
                        "EyQiMU/9oADAMBAAIRAxEAPwDmv2BdhuJ8oYbZ9yXcRauVnE8Ga1V1rGiuP2VlKNehEjtuIQKSj" +
                        "8xwzEgbb0XQiJNmxomlirnS5btwcQpwC7zBzyjW36dSTp8oZnsY4taSmZwBIC4G+EbcUPt45C9I" +
                        "4pzfAr3Ha2OZ1p5PW3y2zjDrZK0Ug62fHRhQ3Ju2t7SRPRdfCSt8TdLLmscHISACEsOOPKDekeY" +
                        "f0yJU57cudjXFDYSATyXjBwyP2x52J99uPdu0/IIw8Q5THk30LKjfkDXLSxa1+7KaJISuq0saKZ" +
                        "I2pIe4Sb3aojijnUiTA1LSiXrhDltcDKL1sCrwjY+OLn729uHDX8KLqMYdcynsgYY8ya+uiR47E" +
                        "oxTz2g7GJlS9EX4+FXjE1oel7mhOV22EEvKJLnDfvAJXnt74jcx5Hhcg4+w/OKJCyaPMluN18Jo" +
                        "hOQ3KGMoqKCiqZK4JqpEuqr5J+SOaiszENeircMdr4m+laN/C89vM5pa0KSqZV9gQhAIunPVVe2" +
                        "2e8GdvcRVPmerxe+CVDRfnip0l1YpAX8eoLL4N7PXU9PE+dVSxXib+Jf0ResU+XTzDQOZfl6gp0" +
                        "gn+3pcd5mO5bYTO22n+4cYUpCWsN+TFiQ0aRNX1dcslbY6W3Tf1EUPgvn4OUjpgHpCjayE1e2Uf" +
                        "vKQj7LmHlSwmRoXFnEmOQuYPr4SwZVNb4sMj+wGSKtJFVq1lj+400Xptaaa66J436mZW9v9jX5e" +
                        "NnP6wcp5VD3PQ9q8Afl8IKE+d3l/7Hg29vCe/wBKdZw6qqMz6nU3H1AA0P8Alpv1VXN2v6J4Pud" +
                        "M7gJG+EzWyu0QD6Y//9k=",

        'Malekus':      "/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAVQAA/+4ADkFkb2JlAGTAAAAAAf/" +
                        "bAIQAAgEBAQEBAgEBAgMCAQIDAwICAgIDAwMDAwMDAwQDBAQEBAMEBAUGBgYFBAcHCAgHBwoKCg" +
                        "oKDAwMDAwMDAwMDAECAgIEAwQHBAQHCggHCAoMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD" +
                        "AwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAFgAWAwERAAIRAQMRAf/EAIUAAQADAAAAAAAAAAAA" +
                        "AAAAAAgFBgkBAAIDAQEAAAAAAAAAAAAAAAMEAgUGCAcQAAIBAgUCBAUFAAAAAAAAAAIDAQQFERI" +
                        "TBggAByExQSJRMkIUFVIjZBYXEQACAQIFAgQFBQAAAAAAAAABAhESAwAhMQQFQRNRYYEicbEyFA" +
                        "bwoWIjM//aAAwDAQACEQMRAD8Ax8438d29wjdu3dD2qsYMzE0gmoFYMJ0KEEm1Qte6UHkEigREZ" +
                        "IsfbE0fIcglgVXJW2CAzAaE+PgvQkdT0x6V+Ifh1/lXO32YS5vWtm5btOYqVTogOT3SJZUYgFBP" +
                        "uJACRsvFzsjv3bNSior7tZ6dITjcbgduuNMJeQ6lGqioiwmfDBTRKPSZ6LuxttraN92pUdQT6Rr" +
                        "M9BnOEfx61zXO79OK2lvvXnJHbZFAEfVVkO2FzqaVpjUHBzruIO+rZyIoez00tQR3NTqmKSXMGA" +
                        "Wigi7SzUn3SiaaIdE4Z8mMYZ46gN45slipqC1RAqI+ExVHSdY+GD3PxvajlF263rRtG6bTNW3aW" +
                        "4Mge5TV2SxBDxNAbwqKC4m2zb28OOz3JcoTtLkXOsUbAURU50aLXmGTmMZXU0RjMfFgfrjGQvLa" +
                        "sXKwDBMg9ZMgddQchGemFbexvbzlNt9u7IXS2VdRmlCBS2qwEZDU0ikAnFjud/RtSoXCCL7EDJt" +
                        "MFVEQxjYnT/eGZGBMZjwzeXr7sMcptbBsOl26pNoFqEJ/ygwS2RyHrRoJGeOgOc5teV2252WzvL" +
                        "b37JaG63KIAd8GQsEswwILQCR7fuACzUkBTEdx91VNbyK7f0tO2B3zT2+sQ0dSIYTEWq7VRozep" +
                        "5K9SMPPPiHnGHW1ZgdwCOimfUiPkccyWbbJx1xWBl7qBRGpRXqy8q1Hrgz8Tbh35s28qR3au3Kv" +
                        "NIy6iu3076impZXcp8c9K24RpxMBhq5wJWXDUj5eg7hUa4sEB8tRI8p89YzB1jDvGXdym1cMjNY" +
                        "NU0mGAyrIifZ9NYZSmkw0HCY333B5CtRWJqNg20N1gp8vMLntVZlgM6mmxVVUCRT/AB1Ac/TMT0" +
                        "ZjfIg0geOZ/Yx88JWk49HDI152kQoVVMzlDAuZnSFnwwTKur71/wC00l2u1LR/277QnWu1uJf4/" +
                        "wDH6ZyalHJ6eXT1ImYZnz4+Op0qq2OwVU+3qf10iOkR5Yttxf5D7+3cuW/7M6FkzMmQDNXcqmc+" +
                        "53P5QMf/2Q==",

        'Corvintheus':  "/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAVQAA/+4ADkFkb2JlAGTAAAAAAf/" +
                        "bAIQAAgEBAQEBAgEBAgMCAQIDAwICAgIDAwMDAwMDAwQDBAQEBAMEBAUGBgYFBAcHCAgHBwoKCg" +
                        "oKDAwMDAwMDAwMDAECAgIEAwQHBAQHCggHCAoMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD" +
                        "AwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAFgAWAwERAAIRAQMRAf/EAIIAAQEBAAAAAAAAAAAA" +
                        "AAAAAAgHCQEBAQEBAQAAAAAAAAAAAAAABgUHAAEQAAAGAQQCAQMFAAAAAAAAAAECAwQFBhESFQc" +
                        "IExQAISJCMTJDFwkRAAIBAgQEAgkFAQAAAAAAAAECERIDACExQVFxBAVhIoGRoTJCghMjFLHB0W" +
                        "JyBv/aAAwDAQACEQMRAD8AzJ6k9Y4NoyjbjdEkH3Is4VOWab22NJR9fjnay6UaIRah0038pImbK" +
                        "KoJOR9VFsBVVCqisQqZrunXMtp7izRbgGDBZiQIDfConMjOZAiM7fbeiF66ttjBYEyRIUAEzGUk" +
                        "xkCQNJ1yc/Kf+fPaCj8Zq2nmKaO64y0kK9jJlnVJ2Oik1FCoFM4im0LGlImJjgBhjXRFUw+pDDj" +
                        "PwB03/UIbp+2sf1Zww+ZiQ/JlUHDBux2bgCI7hjAlghUk8VEFB4hnIwIbB0WbxPaev16Cr/u1aW" +
                        "fPYWbpyk46RjYuWaxm8IrbvoO6Ug3LUSvkjYK6MgRdvq86XmNpyNdJbp2YBxBDRqvGNKhmDtMGI" +
                        "MYAmiBdA8u4nQ8J4e3UbTi9cIPYKTbxHJrUFHVfjUqBc1SMkvIopBs61C1V0oQgCAmTZyVeetFM" +
                        "ftNgPzDMbrrVfbr1uCWVmmP91A8oIPLFbtrR1tsggVLAnIe4VieM5DacLLsNz7ykXiezueUeWIu" +
                        "d6vyDCYLxc2iW5d7n3E4r5kkpEchpJEBlMpvp+oasGDHzMbHRWiyhLbfUMBtx8vEvr4csK+nN9b" +
                        "pLMKUk55RB+LgF08ecYIk7aXZX7FBY5k7i+eQ0MxQNgFnMhA123ykggXIhlVu2srFAxQyOtYpMZ" +
                        "yAbTd83VoB8KNPzFY9dJ9WM9TKyxO7CPRM/qMHfo3Y+0FdYxbKp1t3ZeOJCWlkau4hpJpFzca9K" +
                        "1SNLrx6r9JwmaPFHwg/I7bKMjfYBxTVEhw8uJVemy1NwATlII2q0z1jMHmMscphPuCUnLYg7x++" +
                        "UenFxczYtJh+9r8bNS1z1a9pjWdGgTisQfvIwlAnp9IFDH/JrHicTY0AQcYgdvNs9S30BbFwznL" +
                        "EDjQCFHOlvZhF3H8n8Vfr1G2I2UE5eWsgltPdqGDZcrl2B/vqoXq9VGI2ba3i9JpKztbatt8rsj" +
                        "tBB0m99rc/a85jmM4973cfzaC/Ltq0lLojNXUKmjzVZRlGmm1NPhOD7s0hmApjIbR/PpmfHH//Z",

        'Aurora':       "/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAVQAA/+4ADkFkb2JlAGTAAAAAAf/" +
                        "bAIQAAgEBAQEBAgEBAgMCAQIDAwICAgIDAwMDAwMDAwQDBAQEBAMEBAUGBgYFBAcHCAgHBwoKCg" +
                        "oKDAwMDAwMDAwMDAECAgIEAwQHBAQHCggHCAoMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD" +
                        "AwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAFgAWAwERAAIRAQMRAf/EAIUAAQEAAAAAAAAAAAAA" +
                        "AAAAAAgJAQACAgMAAAAAAAAAAAAAAAAEBgEDBQcIEAABBAEEAgECBwAAAAAAAAADAQIEBQYREhM" +
                        "HFAgAMhUxIkJjFhcJEQACAQIEAwUFCQEAAAAAAAABAhESAwAhMQRBYQVRsSJSE/BxwdFCgZGh4f" +
                        "EyYhQVBv/aAAwDAQACEQMRAD8AlB6l+qd/2bJNdtiksLgYfvEhxI6zh1sIpnjitHCK8Y5M6VxuI" +
                        "Nhl4hhTe5pFe1rVjqPVrNpgL9z0rc0z5miSJ+kDidZykRmJf3ABhmhZj3n4YSOG+tNH2/HPhzbW" +
                        "8iSxo8T0vQ01rXhc38qoesZWQVG1FTRfHKN7f0rr8I3O32O2tf2HahfPUeOmcmqeAznsxLJbQVT" +
                        "HOT7HBnsfT3IYHs5XdUQa5TOnzT082mfOmDgxZQQeaOSkvjWS+tKDSSxdqHUbSC15Gciir1pDtj" +
                        "ca4AoAYPTqsxNPmGYIiJgxBjELufASW4TPKezt/XDA/wAsJCZDdBHjUmMMzn1VhOSWJxmkqT4/X" +
                        "0vI1jCCVeCfTHjKuujXqmv1Jqt/9jt7b9FveoGLWnY5EAyWMEyDkQ4J5YD3yg2GnVSe/wCRxQCw" +
                        "h+tcrL+wca6zHHh91QYsCTey5bHFjkcQGg3I1j2aoxdqG2qi7tNV1+aFf/UTabS5uyx2rM1ABg6" +
                        "58Dmc6ZnKYywun1giF/2GY9u7E0Mwz+2me0+NWEcoG9gjdHiOaqKgiz4NfkdocCN13KogXEYKs1" +
                        "3akRn1Jp86du9LtMibMA0LYZT5oakDlJpPKRhsNkGLY0Cn8Y+WDF6c2Ps3VZTXh6XrJ9uSTPmso" +
                        "34/KSHaxZCMGs0kV5RkasZW8SSUOJ8dV2I7a/a5COqpt2W4bjAAJ46hKFP56c4ghveMWbhUJaSB" +
                        "lnOkc/hxwprjK/cYtrbgxnHLB3ao48tbv+ONx+BcFCip5SOlBubZUVXablFDRyr+G1dPgO7ey21" +
                        "tC8thbMrQSaln6KRC/Z4tNcpxU8FBVSFyjiOUCB34Gdzc9x/3DUZDkNRF+6eOYlBQEMfh4+cqGG" +
                        "MrTc/mc/IrlUvk+R+5tT5mbVpaXRGauoVNHiqyjKNNOFNPKcEKgggEzOZ4z935Rj//2Q==",

        'Azeron':       "/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAVQAA/+4ADkFkb2JlAGTAAAAAAf/" +
                        "bAIQAAgEBAQEBAgEBAgMCAQIDAwICAgIDAwMDAwMDAwQDBAQEBAMEBAUGBgYFBAcHCAgHBwoKCg" +
                        "oKDAwMDAwMDAwMDAECAgIEAwQHBAQHCggHCAoMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD" +
                        "AwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAFgAWAwERAAIRAQMRAf/EAGsAAQEAAAAAAAAAAAAA" +
                        "AAAAAAgJAQEBAQAAAAAAAAAAAAAAAAABAgMQAAEDAgUCBAYDAAAAAAAAAAIBAwQFBhESEwcIABQ" +
                        "xIhUJIUEyQmIWM0QXEQEBAQADAAAAAAAAAAAAAAABABEhQQL/2gAMAwEAAhEDEQA/AI58ethnb+" +
                        "kS7muKYUSgQybdmTnm+67dJJuJGjx4zhgD0p9GjNEcXTbbTOSEpCPUgZUtQmkeyg5upxKp3J7ba" +
                        "7JFZ20lNKNZkxKhT6y9bcgSVsm6zRXKZAJsRVMSKM6mAqhCuCoqmkQKkcMNzInKuPxvbZYW5Jb5" +
                        "xXAOe8FLBoI3qQzxl4K6UE4grJT4auQTb/kHFVCRml7Hd+bQ29cb8vda2ot47bNSDC8qBLjsSXD" +
                        "oNaokOjJPjg+ipnhS6caIqYKhYChCpovQmkdyZ5Pcsmvbkvxqwfb8u+3K9wfuejzQl0ZuSFWkTp" +
                        "tRh+nzv2lpQizYzzSGgxQzNoIj5kVVLqPPnGVgPflyy6tyusymwHsLzp1DKmzFzojpyW6XXagUf" +
                        "H5ugxUWW8vjmPL4ph1qwR64hv8AJWDudETjzHkzrncfmDC9MeBh5oEbRZhEUsCY7XTypISQCsYY" +
                        "ZsFyr0DxKSOu+8eXs15+E1alIj30KFqSaa5bLEwzRP67hVWe1qL9uhHQsfowXp2MiJJlbpf6jGq" +
                        "VRjJ+4ec6fTiORn1O4LOAGha3caubFVPV1fzwToWcv//Z",

        'donate':       "R0lGODlhkwAvAOZ/AJCRh+yLNfSqnv/KeC9ss9fa3COZ1f++WuU2Mv+sLIGr0f7hqOLj5ChKbF5y" +
                        "h9Xn9La5unqHhbfS5optTfnU0f/v0/+yPEmy4//25edbNXdwY9bJqNiaN2rE743M7EhTVD9Vd/7p" +
                        "wMrd7ruwki88cmGTx+X0+206XElkfLg3QbiLPuxiX7l6RqF+SRU6Z8+HRUCDvP/syf7envKpdv7S" +
                        "h2hkUffAv42ar/Hm5a2qnuyYQrW9yf63RVKKvysgDF6k1aSstkA3J6uyuL7Bwf718vXGqPKcauLt" +
                        "9vbCmPP6/crO03iHn/H2+it9wV696/+pJv/z3P/Wlv/itP/57v7nuv/9+P7mtf+vNP7ksP7fogBX" +
                        "oMnGwcjMzcPHyMfKzL1nKMW7nk5FNfLz9u+mNe7YqO7cspe72vHx73ChypudnIR+c+7Tmv7amBBi" +
                        "pvvk0LpOQf/gsKadjefb19HS09zNz52ms97KnV5RY/nRt66wpOqhIQAzZgAAAP+ZM////////yH5" +
                        "BAEAAH8ALAAAAACTAC8AAAf/gH+Cg4SFhoeHfYqLjI2Oj5CRkpOSiJaXmJmahooDUlBVoaKjpKWm" +
                        "p6ipqqQxUYqbsLGyhH00UFO4ubq7vL2+v8DBwXB9s8bHiVIYy8zNzs/Q0dLT1NXLUMXI2rN9MVDf" +
                        "4OHi4+Tl5ufo6eEV2dvumH0yFfP09fb3+Pn6+/z9+O3vAhbiEaOgwYMIEypcyLChw4cLyQicOKhW" +
                        "iIsYM2rMmGaPxz0uIpTZSLKkyRAb8pxcuREgRXcWBlCZSbOmzZoR9jRAgcLFHhQ3gwodmsYFmKFI" +
                        "hVp4GbAPjwNWokqdSnUqij1gopbxuUFqGTBZq1rZAKbM1K9hpfo0G5VsV7Fw/6ey4eGSqTGnPGhg" +
                        "2cu3r1++HsnwzQlgb06PLtLsBaPTAeINhj+6gLzh4540ZBx7RCH4r+e+B+ja3YaXB5sFqFOrXr2A" +
                        "MQjVOSMscAwiRxyfdhYA2DwCxB7ZOfaAGJETxYIRVxtEIHPVQe89AFhLVz2Ah+jRyErnnS59twPY" +
                        "v+2AJIOa8OyfqB3HWR0H/YLYrXWiHuGeu2oZoa3XxQ6rj4X//x1AQxYEFmhggY4BYGADWHlXYGxZ" +
                        "MDgCgQyCkQUYPX0UAYG+5ZDFbi6AgIJvIBxoIoEyVAegBfvxp4l/K/73FA00yGDjjTf6NsKNuzUg" +
                        "Q2w3XhXHGh7ZSOQeMqzhU/8EYHRoI4N2/ChcBFRGEAeOWLJBwwAHxPhfiy7Cc8WYZJZpppkejTnG" +
                        "BB6pcEULe3wwJgcgjaFCnGPeKaeeV4zhEwdX0OnCmHDWkCegZyaaKJhhWtJHApBGKumkkt5pmUct" +
                        "QOrnHjXU4FOmbNYAaagJ0Mkpg3tAeqcLE3AwBoOd6jQGpbTSymijiDxa664qfOCrr61KysEHHjWg" +
                        "wqgfqPBEAhMkuyybxvoaKbF7cFAqtTVYu+u2t+KayBPghivuuOSWa+656KarLrrdesuJl/DGK++8" +
                        "9NZr77ztuluIUwf06++/AAcs8MAEF2zwwQLnqy8tAzTs8MMQRyzxxBRXbPH/xRErvDAtNETh8ccg" +
                        "hyzyyCSXbPLJKH+s8cYcS+HyyzDHLPPMNNds8804y7Ayy7TUEoM/QActdNDEPMEzaZQkrfTSTDdy" +
                        "9NNQRy311FRXbfXVWGet9dZcd601CWCHLfbYZIM9iB9op6322myjbYgTTnTQgRMXGGB3E3gToDch" +
                        "fPTt99+AB963IEMIbrjg74x9QgqMnwA2CBOwwMIEd4x9dtuYt/123HPXfXfeew/CxxaZl+4HH4Tz" +
                        "wcDqrLfuuuuouxP2CQjUbnsKEwSg++4siH256aW/LXfnnuPdhN4E8E068G3HXngB0Ecv/fTTx74N" +
                        "2LTbrn0Gu3f/Qti/M695/yGcE//58aELMvoWW5wxxxYMnAG/G26sLv8W789xhvN8zOH//wAMYACt" +
                        "pw2waW973Ove7iZgNkH4AQNcOoAfjgCDEqABBkxAQxu0UAI/SAAGPUibITrggRJ6oHM/SGEJStCD" +
                        "HijPBzUIgw98EAcfqKEFRpgBCzSggSB8AABhCMIc+OeFIhrxiEhEIgGRQYITrCADKzhgBqaogxno" +
                        "YHc6+B4JfhcHPYTADFpQAAG0AEYCoEEBfhijFpjgtkKYwARJMIEIjvDGOT5ABEwQgQheOAcfhEED" +
                        "fvQDEopAAQEEIQgACAIgNXC61EEABC5wwRIg4AAX3AACLnDAI2/gAiCQYP8JhUtcCuggBz8U0gYU" +
                        "oIANBEABIsihAkVwgxTkgIQG/iFtZkABG8Z4BC3AoIwS8KAWhhlMPxjiCEdIQhKCKcc56vEIenyh" +
                        "In0QhDBYcwI5xAMA1JBIDXwgDI38Q+GAAAIHNECTJDgnJjMJAk6KSAlAWOIxSJACMaDNnn7AQQHQ" +
                        "hgM3vIABfmAABnAwg8r9TgRaiIAWeiABDjIBBsQsARnD2EZCXOACTjBhCc3AUY4qQAHKW9scckBS" +
                        "CLAPAgBgG/+EAIKWNoCTlayDJV3wUpqiQAhCkKcxmrhPP4iBCAwQQwFWFwcxYABtdBCDGGq5RQem" +
                        "bYNakAAYFSACPyhAC2j/GOYwQ2jMQtjtAmgzwQOY8IAj+IGNyAyp2mrwwxwEQQ1qqEEQ1IaBGfDv" +
                        "kSBowDlRcAMULMEFO/grJz2JAgjodBZNZJxiFfuGN2TgBS+QXGRZoMXw9UALBLBqVLWK2YWKMbNd" +
                        "JUQTDPCDI4xVAqaF5hHyuEfRLU98RECC7u4KhB3sAJ5zgEBthZBbIRQACHMQwm0PKwsDHtB2U1Sg" +
                        "7oJgS7VJQAHBfO4RPgpdMyjArNat6CDwBgMVlqCCKwxvCdQKPAzIdnf8G4J618ve9raXuLHA3nFr" +
                        "l0AFtgB8ThXf+ERrPNAh77/kxRwR8GAE5fKvCwhOsIIXvGD4wmJ2KThgeQru8AIFMhC/t9Tvfgfx" +
                        "3w57OMBqG/AMlIve1HHhxChOsYpV7OBNKO4EMBbbHSZAObKFT8MiHIQB/uDhHqfvD3yIA/uGDIYR" +
                        "sOALSE6ykpHMvzQ4+clQjnKUW6yJslnZyjfGcWj/4AEe+/jDojucmP0miP2NWcyZCAQAOw==",

        'bg':           "R0lGODlhFQAJAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw==",

        'desc':         "R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7",

        'asc':          "R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7"
    };

    ////////////////////////////////////////////////////////////////////
    //                  offline OBJECT
    // this is the object for offline items database
    /////////////////////////////////////////////////////////////////////

    offline = {
        items: [
            {
                "name": "Air Shard 1 of 5",
                "image": "gift_valhalla_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Air Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Valhalla, The Air Elemental",
                "comment": "Piece is used to create Air Orb which in turn is used to summon Valhalla, The Air Elemental"
            },
            {
                "name": "Air Shard 2 of 5",
                "image": "gift_valhalla_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Air Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Valhalla, The Air Elemental",
                "comment": "Piece is used to create Air Orb which in turn is used to summon Valhalla, The Air Elemental"
            },
            {
                "name": "Air Shard 3 of 5",
                "image": "gift_valhalla_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Air Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Valhalla, The Air Elemental",
                "comment": "Piece is used to create Air Orb which in turn is used to summon Valhalla, The Air Elemental"
            },
            {
                "name": "Air Shard 4 of 5",
                "image": "gift_valhalla_4.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Air Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Valhalla, The Air Elemental",
                "comment": "Piece is used to create Air Orb which in turn is used to summon Valhalla, The Air Elemental"
            },
            {
                "name": "Air Shard 5 of 5",
                "image": "gift_valhalla_5.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Air Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Valhalla, The Air Elemental",
                "comment": "Piece is used to create Air Orb which in turn is used to summon Valhalla, The Air Elemental"
            },
            {
                "name": "Alpha Bahamut Artifact",
                "image": "eq_alpha_bahamut_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Transcendence",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Amber Ore",
                "image": "gift_araxis_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Araxin Blade",
                "recipe1image": "gift_araxis_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Amethyst Crystal",
                "image": "eq_strider_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Assassins Blade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Amethyst Crystal",
                "image": "eq_strider_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Assassins Blade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Amethyst Egg",
                "image": "gift_sea_egg_amethyst.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Amethyst Sea Serpent",
                "comment": "Obtained from the Serpent Egg gifts"
            },
            {
                "name": "Ancient Egg",
                "image": "gift_sea_egg_ancient.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Ancient Sea Serpent",
                "comment": "Obtained from the Serpent Egg gifts"
            },
            {
                "name": "Ancient Frost Hilt",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Glacial Blade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ancient Hatchet",
                "image": "gift_turkeyday_promo_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": "Noktar",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ancient Lichen",
                "image": "gift_elizabeth3_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Staff of Vigor",
                "recipe1image": "gift_elizabeth3_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ancient Parchment",
                "image": "eq_gift_elizabeth2_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Silverlight Tome",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ancient Symbol",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Cid Helm",
                "recipe1image": "gift_cid2_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Anvil",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Cid Helm",
                "recipe1image": "gift_cid2_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Aquamarine Relic",
                "image": "gift_chase_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Chase Family Heirloom",
                "recipe1image": "gift_chase_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Assassins Ankh",
                "image": "gift_strider2_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Assassins Cloak",
                "recipe1image": "gift_strider2_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Atlantean Map Piece",
                "image": "seamonster_map1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Map of Atlantis",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Atlantean Map Piece",
                "image": "seamonster_map2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Map of Atlantis",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Atlantean Map Piece",
                "image": "seamonster_map3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Map of Atlantis",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Atlantean Map Piece",
                "image": "seamonster_map4.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Map of Atlantis",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Bahamuts Blood",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Draganblade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Basilisk Heart",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Staff of Vigor",
                "recipe1image": "gift_elizabeth3_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Bat Totem",
                "image": "gift_strider2_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Assassins Cloak",
                "recipe1image": "gift_strider2_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Battle Heart",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": "Chase",
                "recipe1": "Deadly Strike",
                "recipe1image": null,
                "recipe2": "Invulnerability",
                "recipe2image": null,
                "recipe3": "Tempered Steel",
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Battlegarb Piece 1 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Sophias Battlegarb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Battlegarb Piece 2 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Sophias Battlegarb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Battlegarb Piece 3 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Sophias Battlegarb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Battlegarb Piece 4 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Sophias Battlegarb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Battlegarb Piece 5 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Sophias Battlegarb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Battlegear Shard 1 of 3",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Garlans Battlegear",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Battlegear Shard 2 of 3",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Garlans Battlegear",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Battlegear Shard 3 of 3",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Garlans Battlegear",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Bituminous Coal",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Fiery Blade",
                "recipe1image": "gift_dante_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Black Widow",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Shadow Blast",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Bloodblade Shard 1 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Bloodblade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Bloodblade Shard 2 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Bloodblade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Bloodblade Shard 3 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Bloodblade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Bloodblade Shard 4 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Bloodblade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Bloodblade Shard 5 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Bloodblade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Bull Totem",
                "image": "gift_zarevok_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Zarevok Plate",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Cid Saber Shard 1 of 6",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Cid Saber",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Cid Saber Shard 2 of 6",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Cid Saber",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Cid Saber Shard 3 of 6",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Cid Saber",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Cid Saber Shard 4 of 6",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Cid Saber",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Cid Saber Shard 5 of 6",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Cid Saber",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Cid Saber Shard 6 of 6",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Cid Saber",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Clockatrice Feathers",
                "image": "gift_terra_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Terra's Blade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from receiving Mystery Relic (Terra) gifts"
            },
            {
                "name": "Conch Shard",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Poseidons Horn",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Crest Shard 1 of 4",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Zenarean Crest",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "War of the Red Plains",
                "comment": "Crest Shard creates Zenarean Crest which in turn summons War of the Red Plains"
            },
            {
                "name": "Crest Shard 2 of 4",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Zenarean Crest",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "War of the Red Plains",
                "comment": "Crest Shard creates Zenarean Crest which in turn summons War of the Red Plains"
            },
            {
                "name": "Crest Shard 3 of 4",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Zenarean Crest",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "War of the Red Plains",
                "comment": "Crest Shard creates Zenarean Crest which in turn summons War of the Red Plains"
            },
            {
                "name": "Crest Shard 4 of 4",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Zenarean Crest",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "War of the Red Plains",
                "comment": "Crest Shard creates Zenarean Crest which in turn summons War of the Red Plains"
            },
            {
                "name": "Crimson Leaf",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Crimson Dagger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dagger Fragment",
                "image": "eq_strider_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Assassins Blade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dagger Fragment",
                "image": "eq_strider_4.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Assassins Blade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dagger Piece 1 of 2",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Crimson Dagger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dagger Piece 2 of 2",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Crimson Dagger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dantes Shard",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Shield of Dante",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Darkness Essence",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Mystical Dagger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Draganblade Shard 1 of 4",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Draganblade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Draganblade Shard 2 of 4",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Draganblade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Draganblade Shard 3 of 4",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Draganblade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Draganblade Shard 4 of 4",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Draganblade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dragon Blood",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Dragon Charm",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dragonbloom",
                "image": "gift_dragan_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Dragan Protector",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dull Blade",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Mystical Dagger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Elf Root",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Elven Crown",
                "recipe1image": "gift_aeris_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Elixir of Life",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Silverlight Tome",
                "recipe1image": "eq_gift_elizabeth2_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Elven Fern",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Silverlight Tome",
                "recipe1image": "eq_gift_elizabeth2_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Emblem of Azriel",
                "image": "eq_azriel_ring_shard.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Signet of Azriel",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Sometimes dropped after slaying Army of the Apocalypse"
            },
            {
                "name": "Emblem of Keira",
                "image": "eq_keira_ring_shard.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Signet of Keira",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Sometimes dropped after slaying Army of the Apocalypse"
            },
            {
                "name": "Emblem of Lotus",
                "image": "eq_lotus_ring_shard.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Signet of Lotus",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Sometimes dropped after slaying Army of the Apocalypse"
            },
            {
                "name": "Emblem of Sylvana",
                "image": "eq_sylvana_ring_shard.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Signet of Sylvana",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Sometimes dropped after slaying Army of the Apocalypse"
            },
            {
                "name": "Emerald Egg",
                "image": "gift_egg_green.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Dragon",
                "comment": null
            },
            {
                "name": "Emerald Egg",
                "image": "gift_sea_egg_emerald.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Emerald Sea Serpent",
                "comment": "Obtained from the Serpent Egg gifts"
            },
            {
                "name": "Enchanted Mythril",
                "image": "gift_chase_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Chase Family Heirloom",
                "recipe1image": "gift_chase_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Enriched Mineral",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Ring of Life",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Essence of Darkness",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Shadow Blast",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Essence of Valhalla",
                "image": "eq_valhalla_dust.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Stormbinder",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Used to create Stormbinder.  This item can be dropped by Agamemnon, the Overseer or created via Alchemy."
            },
            {
                "name": "Eye of the Bull 1 of 2",
                "image": "gift_zarevok2_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Zarevok Defender",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Eye of the Bull 2 of 2",
                "image": "gift_zarevok2_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Zarevok Defender",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Faerie Thistle",
                "image": "gift_aeris2_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Aeris Dagger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Fairy Dust",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Dragon Charm",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Favor Shard 1 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Favor Points",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Favor Shard 2 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Favor Points",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Favor Shard 3 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Favor Points",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Favor Shard 4 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Favor Points",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Favor Shard 5 of 5",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Favor Points",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Feather",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Dragon Charm",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Fiery Starfish",
                "image": "gift_nautica_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Nautical Trident",
                "recipe1image": "gift_nautica_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Fire Berries",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Fiery Blade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Fire Core",
                "image": "gift_dragan_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Dragan Protector",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Fire Lizard Claw",
                "image": "gift_araxis2_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Conflagration Shield",
                "recipe1image": "gift_araxis2_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from receiving Mystery Shield gifts"
            },
            {
                "name": "Flameshrooms",
                "image": "gift_vanquish3_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Flamestrike Amulet",
                "recipe1image": "gift_vanquish3_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from receiving Mystery Amulet Gifts"
            },
            {
                "name": "Fox Totem",
                "image": "gift_araxis_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Araxin Blade",
                "recipe1image": "gift_araxis_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Frost Egg",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Dragon",
                "comment": null
            },
            {
                "name": "Frostwyrm Hide",
                "image": "gift_edea2_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Mystic Robe",
                "recipe1image": "gift_edea2_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from Mystery Robe Gifts"
            },
            {
                "name": "Frostwyrm Scales",
                "image": "gift_shino_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Frostwolf Axe",
                "recipe1image": "gift_shino_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from receiving Mystery Axe Gifts"
            },
            {
                "name": "Gargoyle Statue",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Zarevok Plate",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gingko Leaf",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Titania Bow",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Glimmering Lotus",
                "image": "gift_aeris2_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Aeris Dagger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Glowing Spessartite",
                "image": "gift_araxis2_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Conflagration Shield",
                "recipe1image": "gift_araxis2_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from receiving Mystery Shield gifts"
            },
            {
                "name": "Gold Egg",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Serpentine Shield",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Dragon",
                "comment": "Piece is also used to summon Cronus, The World Hydra"
            },
            {
                "name": "Golden Seahorse",
                "image": "gift_nautica_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Nautical Trident",
                "recipe1image": "gift_nautica_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Green Tanzanite",
                "image": "gift_terra_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Terra's Blade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from receiving Mystery Relic (Terra) gifts"
            },
            {
                "name": "Hawk Totem",
                "image": "gift_turkeyday_promo_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": "Noktar",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Heart of Ice",
                "image": "eq_glacius_ingredient.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Hammer of Storms",
                "recipe1image": null,
                "recipe2": "Aegis of Stone",
                "recipe2image": null,
                "recipe3": "Helm of Frost",
                "recipe3image": null,
                "recipe4": "Glacial Plate",
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped by Glacius"
            },
            {
                "name": "Hellstone",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Soulforge",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Heroes Resolve",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": "Angelica",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ice Crystals",
                "image": "gift_shino_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Frostwolf Axe",
                "recipe1image": "gift_shino_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from receiving Mystery Axe Gifts"
            },
            {
                "name": "Ice Shard",
                "image": "eq_frost_crystal.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Glacial Blade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ice Shard",
                "image": "gift_water_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Ice Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Ragnarok, the Ice Elemental",
                "comment": "Piece is used to create Ice Orb which in turn is used to summon Ragnarok, the Ice Elemental"
            },
            {
                "name": "Ice Shard",
                "image": "gift_water_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Ice Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Ragnarok, the Ice Elemental",
                "comment": "Piece is used to create Ice Orb which in turn is used to summon Ragnarok, the Ice Elemental"
            },
            {
                "name": "Ice Shard",
                "image": "gift_water_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Ice Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Ragnarok, the Ice Elemental",
                "comment": "Piece is used to create Ice Orb which in turn is used to summon Ragnarok, the Ice Elemental"
            },
            {
                "name": "Ice Shard",
                "image": "gift_water_4.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Ice Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Ragnarok, the Ice Elemental",
                "comment": "Piece is used to create Ice Orb which in turn is used to summon Ragnarok, the Ice Elemental"
            },
            {
                "name": "Ice Shard",
                "image": "gift_water_5.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Ice Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Ragnarok, the Ice Elemental",
                "comment": "Piece is used to create Ice Orb which in turn is used to summon Ragnarok, the Ice Elemental"
            },
            {
                "name": "Illusion Orb",
                "image": "gift_chase_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Chase Family Heirloom",
                "recipe1image": "gift_chase_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Inferno Potion",
                "image": "gift_vanquish3_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Flamestrike Amulet",
                "recipe1image": "gift_vanquish3_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from receiving Mystery Amulet Gifts"
            },
            {
                "name": "Jackelope Paw",
                "image": "gift_edea2_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Mystic Robe",
                "recipe1image": "gift_edea2_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from Mystery Robe Gifts"
            },
            {
                "name": "Lava Core",
                "image": "gift_araxis2_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Conflagration Shield",
                "recipe1image": "gift_araxis2_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from receiving Mystery Shield Gifts"
            },
            {
                "name": "Lava Flask",
                "image": "eq_magmos_ingredient.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Hammer of Storms",
                "recipe1image": null,
                "recipe2": "Aegis of Stone",
                "recipe2image": null,
                "recipe3": "Glacial Plate",
                "recipe3image": null,
                "recipe4": "Pyromaniac Plate",
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped by Magmos"
            },
            {
                "name": "Lava Plant",
                "image": "gift_dante_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Fiery Blade",
                "recipe1image": "gift_dante_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lava Shard 1 of 5",
                "image": "gift_gehenna_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Lava Orb",
                "recipe1image": "gift_gehenna_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Gehenna, The Fire Elemental",
                "comment": "Piece is used to create Lava Orb which in turn is used to summon Gehenna, The Fire Elemental"
            },
            {
                "name": "Lava Shard 2 of 5",
                "image": "gift_gehenna_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Lava Orb",
                "recipe1image": "gift_gehenna_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Gehenna, The Fire Elemental",
                "comment": "Piece is used to create Lava Orb which in turn is used to summon Gehenna, The Fire Elemental"
            },
            {
                "name": "Lava Shard 3 of 5",
                "image": "gift_gehenna_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Lava Orb",
                "recipe1image": "gift_gehenna_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Gehenna, The Fire Elemental",
                "comment": "Piece is used to create Lava Orb which in turn is used to summon Gehenna, The Fire Elemental"
            },
            {
                "name": "Lava Shard 4 of 5",
                "image": "gift_gehenna_4.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Lava Orb",
                "recipe1image": "gift_gehenna_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Gehenna, The Fire Elemental",
                "comment": "Piece is used to create Lava Orb which in turn is used to summon Gehenna, The Fire Elemental"
            },
            {
                "name": "Lava Shard 5 of 5",
                "image": "gift_gehenna_5.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Lava Orb",
                "recipe1image": "gift_gehenna_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Gehenna, The Fire Elemental",
                "comment": "Piece is used to create Lava Orb which in turn is used to summon Gehenna, The Fire Elemental"
            },
            {
                "name": "Lead Ore",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Cid Helm",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Life Force",
                "image": "eq_jahanna_ingredient.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Force of Nature",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Life force is used to create divine item Force of Nature (DP 80), must be level 175 to create.  Life force is sometimes dropped by Jahanna, Priestess of Nature."
            },
            {
                "name": "Magic Acorn",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Crimson Dagger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Mithril Bar",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Glacial Blade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Mountain Core",
                "image": "eq_shardros_ingredient.jpg",
                "type": "eq_shardros_ingredient.jpg",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Hammer of Storms",
                "recipe1image": " ",
                "recipe2": "Stonebreaker",
                "recipe2image": " ",
                "recipe3": "Aegis of Stone",
                "recipe3image": null,
                "recipe4": "Glacial Plate",
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Mystical Filigree",
                "image": "gift_mercedes_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Witch Locket",
                "recipe1image": "gift_mercedes_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Nature Effigy",
                "image": "gift_terra_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Terra's Blade",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from receiving Mystery Relic (Terra) gifts"
            },
            {
                "name": "Nature Essence",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Staff of Vigor",
                "recipe1image": "gift_elizabeth3_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Nether Flask",
                "image": "gift_morrigan2_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Nether Tome",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Obtained from Mystery Tome Gifts"
            },
            {
                "name": "Nether Soulstone",
                "image": "eq_red_soul.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Soul Crusher",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Sometimes dropped after slaying War of the Red Plains"
            },
            {
                "name": "Otherworldly Vortex",
                "image": "gift_edea2_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Mystic Robe",
                "recipe1image": "gift_edea2_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from Mystery Robe Gifts"
            },
            {
                "name": "Owl Totem",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Titania Bow",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Primordial Life",
                "image": "gift_mercedes_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Witch Locket",
                "recipe1image": "gift_mercedes_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Purple Opal",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Ring of Life",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Red Egg",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Serpentine Shield",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Dragon",
                "comment": "Piece is also used to summon Cronus, The World Hydra"
            },
            {
                "name": "Red Wyrmscale",
                "image": "gift_dragan_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Dragan Protector",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rhino Horn",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Zarevok Plate",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Roc Feathers",
                "image": "gift_turkeyday_promo_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": "Noktar",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rune of Agamemnon",
                "image": "eq_agamemnon_ingredient1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Aegis of Kings",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Aegis of Kings is a divine item (divine power 120), must be level 175 to create.  Rune of Agamemnon is sometimes dropped by Agamemnon, the Overseer"
            },
            {
                "name": "Rune of Darkness",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Shadow Blast",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rune of Fire",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Crown of Flames",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rune of Flame",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Crown of Flames",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rune of Life",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Heart of the Woods",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Sometimes dropped after slaying Aurora. "
            },
            {
                "name": "Sands of Fire",
                "image": "gift_vanquish3_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Flamestrike Amulet",
                "recipe1image": "gift_vanquish3_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from receiving Mystery Amulet Gifts"
            },
            {
                "name": "Sapphire Egg",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Sapphire Sea Serpent",
                "comment": "Obtained from the Serpent Egg gifts"
            },
            {
                "name": "Scepter Shard 1 of 6",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Scepter of Light",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Scepter Shard 2 of 6",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Scepter of Light",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Scepter Shard 3 of 6",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Scepter of Light",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Scepter Shard 4 of 6",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Scepter of Light",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Scepter Shard 5 of 6",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Scepter of Light",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Scepter Shard 6 of 6",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Scepter of Light",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shadow Rune",
                "image": "gift_morrigan2_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Nether Tome",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Obtained from Mystery Tome Gifts"
            },
            {
                "name": "Shadowbloom",
                "image": "gift_morrigan2_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Nether Tome",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Obtained from Mystery Tome Gifts"
            },
            {
                "name": "Shield Shard",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Serpentine Shield",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Cronus, The World Hydra",
                "comment": "Piece is used to create Serpentine Shield which in turn summons Cronus, The World Hydra"
            },
            {
                "name": "Small Emerald",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Elven Crown",
                "recipe1image": "gift_aeris_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Soul of Agamemnon",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Aegis of Kings",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Aegis of Kings is a divine item (divine power 120), must be level 175 to create.  Soul of Agamemnon is sometimes dropped by Agamemnon, the Overseer, but only for the summoner."
            },
            {
                "name": "Spiral Seashell",
                "image": "gift_nautica_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Nautical Trident",
                "recipe1image": "gift_nautica_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Star Crystals",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Excalibur",
                "recipe1image": null,
                "recipe2": "Soulforge",
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Piece is used to create Excalibur which in turn creates Soulforge"
            },
            {
                "name": "Star Fire",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Excalibur",
                "recipe1image": null,
                "recipe2": "Soulforge",
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Piece is used to create Excalibur which in turn creates Soulforge"
            },
            {
                "name": "Star Metal",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Excalibur",
                "recipe1image": null,
                "recipe2": "Soulforge",
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Piece is used to create Excalibur which in turn creates Soulforge"
            },
            {
                "name": "Storm Essence",
                "image": "eq_kromash_ingredient.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Shield of Storms",
                "recipe1image": null,
                "recipe2": "Hammer of Storms",
                "recipe2image": null,
                "recipe3": "Aegis of Stone",
                "recipe3image": null,
                "recipe4": "Glacial Plate",
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped by Kromash"
            },
            {
                "name": "Storm Symbol",
                "image": "gift_giant_storm.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Kromash",
                "comment": null
            },
            {
                "name": "Sword Shard",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Dragonbane",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Sylvan Leaf",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Elven Crown",
                "recipe1image": "gift_aeris_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Tangleroot",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Titania Bow",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Tarnished Ring",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Ring of Life",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Treant Seedling",
                "image": "gift_aeris2_3.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Aeris Dagger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Trident Shard",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Trident of the Deep",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Troll Tusks",
                "image": "gift_araxis_1.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Araxin Blade",
                "recipe1image": "gift_araxis_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Valhalla Dust",
                "image": "eq_valhalla_dust.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Essence of Valhalla",
                "recipe1image": null,
                "recipe2": "Hand of Valhalla",
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Sometimes dropped after slaying Valhalla, the Air Elemental.  Used to create Hand of Valhalla and Essence of Valhalla which in turn are used to create Stormbinder"
            },
            {
                "name": "Valor Crystal",
                "image": "gift_mercedes_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Witch Locket",
                "recipe1image": "gift_mercedes_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Vanquish Dust",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Wrath of Vanquish",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Vanquish Petal",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Wrath of Vanquish",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Vanquish Staff",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Wrath of Vanquish",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Volcanic Egg 1 of 4",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Shield of Dante",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Bahamut and Alpha Bahamut",
                "comment": null
            },
            {
                "name": "Volcanic Egg 2 of 4",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Shield of Dante",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Bahamut and Alpha Bahamut",
                "comment": null
            },
            {
                "name": "Volcanic Egg 3 of 4",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Shield of Dante",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Bahamut and Alpha Bahamut",
                "comment": null
            },
            {
                "name": "Volcanic Egg 4 of 4",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Shield of Dante",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Bahamut and Alpha Bahamut",
                "comment": null
            },
            {
                "name": "Volcanic Emerald",
                "image": "eq_volcanic_shard_green.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Bahamut",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Volcanic Ruby",
                "image": "eq_volcanic_shard_red.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Bahamut",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Volcanic Sapphire",
                "image": "eq_volcanic_shard_blue.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Bahamut",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Volcanic Topaz",
                "image": "eq_volcanic_shard_yellow.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Bahamut",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Werewolf Fur",
                "image": "gift_strider2_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Assassins Cloak",
                "recipe1image": "gift_strider2_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Wolf Totem",
                "image": "gift_shino_2.jpg",
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Frostwolf Axe",
                "recipe1image": "gift_shino_complete.jpg",
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Collected from receiving Mystery Axe Gifts"
            },
            {
                "name": "Wormwood Berries",
                "image": null,
                "type": "Alchemy",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Mystical Dagger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Air Orb",
                "image": "gift_valhalla_complete.jpg",
                "type": "Amulet",
                "attack": 3,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Valhalla, The Air Elemental",
                "comment": null
            },
            {
                "name": "All-Seeing Eye",
                "image": null,
                "type": "Amulet",
                "attack": 11,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 stamina when Gorlak is equipped"
            },
            {
                "name": "Amulet of Cefka",
                "image": "item_cefka.jpg",
                "type": "Amulet",
                "attack": 6,
                "defense": 12,
                "hero": null,
                "recipe1": "Excalibur",
                "recipe1image": null,
                "recipe2": "Soulforge",
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Piece is used to create Excalibur which in turn creates Soulforge"
            },
            {
                "name": "Amulet of Courage",
                "image": null,
                "type": "Amulet",
                "attack": 25,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Amulet of Despair",
                "image": null,
                "type": "Amulet",
                "attack": 6,
                "defense": 5,
                "hero": "Strider",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Amulet of Shadows",
                "image": null,
                "type": "Amulet",
                "attack": 17,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Amulet of the Tempest",
                "image": "demi_energy_amu.jpg",
                "type": "Amulet",
                "attack": 10,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Apocalypse Band",
                "image": "eq_apocalypse_band.jpg",
                "type": "Amulet",
                "attack": 10,
                "defense": 15,
                "hero": null,
                "recipe1": "Signet of Sylvana",
                "recipe1image": null,
                "recipe2": "Signet of Keira",
                "recipe2image": null,
                "recipe3": "Signet of Lotus",
                "recipe3image": null,
                "recipe4": "Signet of Azriel",
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Sometimes dropped after slaying Army of the Apocalypse"
            },
            {
                "name": "Armageddon Pendant",
                "image": "eq_mephistopheles2_amulet.jpg",
                "type": "Amulet",
                "attack": 23,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Araxis"
            },
            {
                "name": "Avenger Amulet",
                "image": "demi_stamina_amu.jpg",
                "type": "Amulet",
                "attack": 5,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Berserker Amulet",
                "image": "demi_attack_amu.jpg",
                "type": "Amulet",
                "attack": 5,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Blazerune Necklace",
                "image": "eq_volcanic_amulet.jpg",
                "type": "Amulet",
                "attack": 9,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Blazerune Ring",
                "image": "eq_volcanic_ring.jpg",
                "type": "Amulet",
                "attack": 7,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Blood Flask",
                "image": "eq_zealot_amulet.jpg",
                "type": "Amulet",
                "attack": 20,
                "defense": 20,
                "hero": null,
                "recipe1": "Blood Zealot",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Stamina to Morrigan"
            },
            {
                "name": "Bloodwell Pendant",
                "image": "eq_vincent_amulet.jpg",
                "type": "Amulet",
                "attack": 28,
                "defense": 28,
                "hero": "Vincent",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Blue Lotus Petal",
                "image": "eq_frost_lotus.jpg",
                "type": "Amulet",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": "Frost Tear Dagger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Caldonian Band",
                "image": "eq_aurelius_ring2.jpg",
                "type": "Amulet",
                "attack": 10,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Chase Family Heirloom",
                "image": "gift_chase_complete.jpg",
                "type": "Amulet",
                "attack": 5,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Gives +2 Defense when Chase is equipped"
            },
            {
                "name": "Cloudslayer Pendant",
                "image": null,
                "type": "Amulet",
                "attack": 9,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Stam when Delfina equipped"
            },
            {
                "name": "Crusader Amulet",
                "image": null,
                "type": "Amulet",
                "attack": 4,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Crusaders Cross",
                "image": null,
                "type": "Amulet",
                "attack": 12,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Crystal of Lament",
                "image": null,
                "type": "Amulet",
                "attack": 1,
                "defense": 3,
                "hero": "Cartigan",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Deathrune Signet",
                "image": null,
                "type": "Amulet",
                "attack": 9,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+4 attack to Skaar"
            },
            {
                "name": "Dragon Ashes",
                "image": null,
                "type": "Amulet",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": "Ring of Bahamut",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dragon Tooth Amulet",
                "image": null,
                "type": "Amulet",
                "attack": 3,
                "defense": 1,
                "hero": null,
                "recipe1": "Drake Helm",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Deathrune Campaign Raid",
                "comment": "Piece is used to create Drake Helm which in turn summons Deathrune Campaign Raid"
            },
            {
                "name": "Earth Orb",
                "image": null,
                "type": "Amulet",
                "attack": 3,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Genesis, The Earth Elemental",
                "comment": null
            },
            {
                "name": "Earth Shard",
                "image": "gift_earth_1.jpg",
                "type": "Amulet",
                "attack": 3,
                "defense": 1,
                "hero": null,
                "recipe1": "Earth Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Genesis, The Earth Elemental",
                "comment": "Piece is used to create Earth Orb which in turn summons Genesis, The Earth Elemental"
            },
            {
                "name": "Earth Shard",
                "image": "gift_earth_2.jpg",
                "type": "Amulet",
                "attack": 2,
                "defense": 2,
                "hero": null,
                "recipe1": "Earth Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Genesis, The Earth Elemental",
                "comment": "Piece is used to create Earth Orb which in turn summons Genesis, The Earth Elemental"
            },
            {
                "name": "Earth Shard",
                "image": "gift_earth_3.jpg",
                "type": "Amulet",
                "attack": 1,
                "defense": 3,
                "hero": null,
                "recipe1": "Earth Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Genesis, The Earth Elemental",
                "comment": "Piece is used to create Earth Orb which in turn summons Genesis, The Earth Elemental"
            },
            {
                "name": "Earth Shard",
                "image": "gift_earth_4.jpg",
                "type": "Amulet",
                "attack": 3,
                "defense": 2,
                "hero": null,
                "recipe1": "Earth Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Genesis, The Earth Elemental",
                "comment": "Piece is used to create Earth Orb which in turn summons Genesis, The Earth Elemental"
            },
            {
                "name": "Earth Shard",
                "image": "gift_earth_5.jpg",
                "type": "Amulet",
                "attack": 3,
                "defense": 4,
                "hero": null,
                "recipe1": "Earth Orb",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Genesis, The Earth Elemental",
                "comment": "Piece is used to create Earth Orb which in turn summons Genesis, The Earth Elemental"
            },
            {
                "name": "Enchanted Lantern",
                "image": null,
                "type": "Amulet",
                "attack": 2,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Eye of the Storm",
                "image": null,
                "type": "Amulet",
                "attack": 28,
                "defense": 30,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Eye of the Triangle",
                "image": null,
                "type": "Amulet",
                "attack": 3,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Fear Charm",
                "image": null,
                "type": "Amulet",
                "attack": 9,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Flamestrike Amulet",
                "image": "gift_vanquish3_complete.jpg",
                "type": "Amulet",
                "attack": 8,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Components are Collected from receiving Mystery Amulet Gifts, +4 Energy when Vanquish is equipped"
            },
            {
                "name": "Force of Nature",
                "image": null,
                "type": "Amulet",
                "attack": 35,
                "defense": 50,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Divine Power: 80, must be level 175 to create this item.  Currently best defensive amulet in game."
            },
            {
                "name": "Frost Tear Jewel",
                "image": null,
                "type": "Amulet",
                "attack": 2,
                "defense": 2,
                "hero": null,
                "recipe1": "Frost Tear Dagger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Frozen Signet",
                "image": null,
                "type": "Amulet",
                "attack": 8,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gildamesh's Charm",
                "image": null,
                "type": "Amulet",
                "attack": 2,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gladiator Pendant",
                "image": "arena3_amulet.jpg",
                "type": "Amulet",
                "attack": 30,
                "defense": 26,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Arena Season 3, Tier 4 Award"
            },
            {
                "name": "Gold Bar",
                "image": null,
                "type": "Amulet",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": "Drake Helm",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Deathrune Campaign Raid",
                "comment": "Piece is used to create Drake Helm which in turn summons Deathrune Campaign Raid"
            },
            {
                "name": "Green Emerald Shard",
                "image": "mystery_armor_emerald_1.jpg",
                "type": "Amulet",
                "attack": 2,
                "defense": 1,
                "hero": null,
                "recipe1": "Golden Hand",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Green Emerald Shard",
                "image": "mystery_armor_emerald_2.jpg",
                "type": "Amulet",
                "attack": 1,
                "defense": 2,
                "hero": null,
                "recipe1": "Golden Hand",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Grimshaw Jewel",
                "image": null,
                "type": "Amulet",
                "attack": 9,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 energy when Aria is equipped"
            },
            {
                "name": "Halcyon Necklace",
                "image": null,
                "type": "Amulet",
                "attack": 12,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Stamina when Halycon is equipped"
            },
            {
                "name": "Heart of Elos",
                "image": null,
                "type": "Amulet",
                "attack": 10,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 stamina when Lyra is equipped"
            },
            {
                "name": "Helenas Memento",
                "image": null,
                "type": "Amulet",
                "attack": 1,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hero Insignia",
                "image": null,
                "type": "Amulet",
                "attack": 20,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped from Season 2 Arena, Tier 3 Award, +8 defense when Shino is equipped"
            },
            {
                "name": "Holy Talisman",
                "image": null,
                "type": "Amulet",
                "attack": 7,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ice Orb",
                "image": null,
                "type": "Amulet",
                "attack": 4,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Ragnarok, The Ice Elemental",
                "comment": null
            },
            {
                "name": "Illusia's Bauble",
                "image": null,
                "type": "Amulet",
                "attack": 8,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ivory Tower Insignia",
                "image": null,
                "type": "Amulet",
                "attack": 13,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Jadan Signet",
                "image": null,
                "type": "Amulet",
                "attack": 9,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Energy when Jada is equipped"
            },
            {
                "name": "Jewel of Fire",
                "image": null,
                "type": "Amulet",
                "attack": 7,
                "defense": 6,
                "hero": null,
                "recipe1": "Helm of Dragon Power",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Juggernaut Medallion",
                "image": "divinedemi_malk_amulet.jpg",
                "type": "Amulet",
                "attack": 30,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Demi Reward: Malekus, Divine Power +10"
            },
            {
                "name": "Keira's Soul",
                "image": null,
                "type": "Amulet",
                "attack": 6,
                "defense": 2,
                "hero": "Keira",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lava Orb",
                "image": "gift_gehenna_complete.jpg",
                "type": "Amulet",
                "attack": 3,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Gehenna, The Fire Elemental",
                "comment": null
            },
            {
                "name": "Lifedrop Pendant",
                "image": null,
                "type": "Amulet",
                "attack": 20,
                "defense": 25,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lionheart Amulet",
                "image": null,
                "type": "Amulet",
                "attack": 1,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lionheart Seal",
                "image": null,
                "type": "Amulet",
                "attack": 20,
                "defense": 30,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Magic Mushrooms",
                "image": null,
                "type": "Amulet",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": "Mystic Armor",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Magicite Earrings",
                "image": null,
                "type": "Amulet",
                "attack": 12,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% critical chance when Azalia is equipped"
            },
            {
                "name": "Magicite Locket",
                "image": null,
                "type": "Amulet",
                "attack": 12,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Energy when Scarlett is Equipped"
            },
            {
                "name": "Mark of the Empire",
                "image": null,
                "type": "Amulet",
                "attack": 12,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Metal Ring",
                "image": null,
                "type": "Amulet",
                "attack": 1,
                "defense": 2,
                "hero": null,
                "recipe1": "Ring of Bahamut",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Moonfall Amulet",
                "image": null,
                "type": "Amulet",
                "attack": 40,
                "defense": 40,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Moonfall Trinket",
                "image": null,
                "type": "Amulet",
                "attack": 8,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Necronic Ring",
                "image": null,
                "type": "Amulet",
                "attack": 20,
                "defense": 24,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Obsidian Amulet",
                "image": null,
                "type": "Amulet",
                "attack": 2,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Opal Pendant",
                "image": null,
                "type": "Amulet",
                "attack": 5,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Overseer Amulet",
                "image": null,
                "type": "Amulet",
                "attack": 15,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Paladin's Oath",
                "image": null,
                "type": "Amulet",
                "attack": 7,
                "defense": 8,
                "hero": "Leon Ironhart",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Pendant of the Bull",
                "image": null,
                "type": "Amulet",
                "attack": 1,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 stamina when Karn is equipped"
            },
            {
                "name": "Pendant of Wonder",
                "image": null,
                "type": "Amulet",
                "attack": 9,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Poseidons Horn",
                "image": null,
                "type": "Amulet",
                "attack": 7,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ring of Bahamut",
                "image": null,
                "type": "Amulet",
                "attack": 5,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ring of Honor",
                "image": null,
                "type": "Amulet",
                "attack": 18,
                "defense": 25,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ring of Life",
                "image": null,
                "type": "Amulet",
                "attack": 4,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Energy when Elizabeth Lione is equipped"
            },
            {
                "name": "Ring of the Prophets",
                "image": null,
                "type": "Amulet",
                "attack": 11,
                "defense": 15,
                "hero": "Shivak",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ruby Ore",
                "image": null,
                "type": "Amulet",
                "attack": 3,
                "defense": 1,
                "hero": null,
                "recipe1": "Ring of Bahamut",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Sacred Amulet",
                "image": null,
                "type": "Amulet",
                "attack": 1,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Seal of Agamemnon",
                "image": null,
                "type": "Amulet",
                "attack": 11,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Serpentine Ring",
                "image": null,
                "type": "Amulet",
                "attack": 20,
                "defense": 21,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shadowfel Pendant",
                "image": null,
                "type": "Amulet",
                "attack": 14,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shadowmoon",
                "image": null,
                "type": "Amulet",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Sharpwind Amulet",
                "image": null,
                "type": "Amulet",
                "attack": 11,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Stamina when Elora is equipped"
            },
            {
                "name": "Signet of Azriel",
                "image": null,
                "type": "Amulet",
                "attack": 15,
                "defense": 40,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Heal +10 additional health upon victory as Cleric in Guild Battles when Azriel is equipped"
            },
            {
                "name": "Signet of Keira",
                "image": null,
                "type": "Amulet",
                "attack": 20,
                "defense": 35,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Gain +3 additional attack and defense as Warrior in Guild Battles when Keira is equipped"
            },
            {
                "name": "Signet of Lotus",
                "image": null,
                "type": "Amulet",
                "attack": 40,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Inflict +30 additional damage upon victory as Rogue in Guild Battles when Lotus is equipped"
            },
            {
                "name": "Signet of Sylvana",
                "image": null,
                "type": "Amulet",
                "attack": 35,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Inflict +1 additional damage upon victory as Mage in Guild Battles when Sylvana is equipped, must be Level 150 to create."
            },
            {
                "name": "Silver Bar",
                "image": null,
                "type": "Amulet",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": "Mystic Armor",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Silverlight Seal",
                "image": null,
                "type": "Amulet",
                "attack": 11,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+4 Energy when Solara is equipped"
            },
            {
                "name": "Skullstone Relic",
                "image": null,
                "type": "Amulet",
                "attack": 10,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2% crit while Adriana is equipped"
            },
            {
                "name": "Soul Catcher",
                "image": null,
                "type": "Amulet",
                "attack": 8,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Soulless Pendant",
                "image": null,
                "type": "Amulet",
                "attack": 25,
                "defense": 25,
                "hero": null,
                "recipe1": "Transcendence",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Sun Amulet",
                "image": null,
                "type": "Amulet",
                "attack": 1,
                "defense": 3,
                "hero": null,
                "recipe1": "Morningstar",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Sunstone Crest",
                "image": null,
                "type": "Amulet",
                "attack": 11,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 max stamina when Suri is equipped"
            },
            {
                "name": "Temptations Lure",
                "image": null,
                "type": "Amulet",
                "attack": 15,
                "defense": 11,
                "hero": "Syren",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Terra's Heart",
                "image": null,
                "type": "Amulet",
                "attack": 6,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% critical when Terra is equipped"
            },
            {
                "name": "Thawing Star",
                "image": null,
                "type": "Amulet",
                "attack": 18,
                "defense": 17,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 defense to Lilith & Riku"
            },
            {
                "name": "Tooth of Gehenna",
                "image": null,
                "type": "Amulet",
                "attack": 18,
                "defense": 23,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Transcendence",
                "image": null,
                "type": "Amulet",
                "attack": 46,
                "defense": 36,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Tribal Crest",
                "image": null,
                "type": "Amulet",
                "attack": 11,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% crit when Kataan is equipped"
            },
            {
                "name": "Trigon Necklace",
                "image": null,
                "type": "Amulet",
                "attack": 13,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+4 Stamina when Crissana is equipped"
            },
            {
                "name": "Truthseeker Pendant",
                "image": null,
                "type": "Amulet",
                "attack": 8,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Valerian Signet",
                "image": null,
                "type": "Amulet",
                "attack": 6,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped by Aurora, Valhalla, Jahanna and Kromash"
            },
            {
                "name": "Vincents Soul",
                "image": null,
                "type": "Amulet",
                "attack": 5,
                "defense": 5,
                "hero": "Vincent",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Vinewrap Ring",
                "image": null,
                "type": "Amulet",
                "attack": 13,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Vortex Seal",
                "image": "eq_valhalla_ring.jpg",
                "type": "Amulet",
                "attack": 11,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped by Valhalla, the Air Elemental"
            },
            {
                "name": "Warriors Insignia",
                "image": null,
                "type": "Amulet",
                "attack": 18,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped from Arena Season 1, Tier 3 Award."
            },
            {
                "name": "Wildwalker Necklace",
                "image": null,
                "type": "Amulet",
                "attack": 10,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 energy when Anwar is equipped"
            },
            {
                "name": "Witch Locket",
                "image": "gift_mercedes_complete.jpg",
                "type": "Amulet",
                "attack": 6,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Energy when Mercedes is equipped"
            },
            {
                "name": "Wolfbane Trinket",
                "image": null,
                "type": "Amulet",
                "attack": 10,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 attack to player when Fenris is equipped"
            },
            {
                "name": "Wolfwood Amulet",
                "image": null,
                "type": "Amulet",
                "attack": 13,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% Critical when Darius is equipped"
            },
            {
                "name": "Angelic Plate",
                "image": "eq_angelica_armor.jpg",
                "type": "Armor",
                "attack": 3,
                "defense": 3,
                "hero": "Angelica",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Arachnid Carapace",
                "image": null,
                "type": "Armor",
                "attack": 0,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Archangels Battlegear",
                "image": "eq_azriel_armor.jpg",
                "type": "Armor",
                "attack": 26,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Archmage Robes",
                "image": null,
                "type": "Armor",
                "attack": 14,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Defense to Azalia"
            },
            {
                "name": "Argentum Plate",
                "image": null,
                "type": "Armor",
                "attack": 7,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Armor of Arielle",
                "image": null,
                "type": "Armor",
                "attack": 6,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Defense to Arielle"
            },
            {
                "name": "Armor of Vengeance",
                "image": "demi_aze_8.jpg",
                "type": "Armor",
                "attack": 13,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Assassins Cloak",
                "image": "gift_strider2_complete.jpg",
                "type": "Armor",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+5 Defense to Strider"
            },
            {
                "name": "Atlantean Armor",
                "image": "eq_seamonster_plate.jpg",
                "type": "Armor",
                "attack": 4,
                "defense": 10,
                "hero": null,
                "recipe1": "Atlantean Forcefield",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Avenger Platemail",
                "image": "demi_stamina_armor.jpg",
                "type": "Armor",
                "attack": 1,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Azure Armor",
                "image": null,
                "type": "Armor",
                "attack": 14,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Defense to Kaylen"
            },
            {
                "name": "Bearheart Armor",
                "image": null,
                "type": "Armor",
                "attack": 11,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Belt of Abaddon",
                "image": null,
                "type": "Armor",
                "attack": 13,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Crom"
            },
            {
                "name": "Berserker Platemail",
                "image": "demi_attack_armor.jpg",
                "type": "Armor",
                "attack": 4,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Bladebourne Raiments",
                "image": null,
                "type": "Armor",
                "attack": 10,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Defense to Miri"
            },
            {
                "name": "Blood Vestment",
                "image": null,
                "type": "Armor",
                "attack": 10,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 defense to Slayer"
            },
            {
                "name": "Bloodlord Plate",
                "image": "eq_vincent_armor1.jpg",
                "type": "Armor",
                "attack": 26,
                "defense": 14,
                "hero": "Vincent",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Braving the Storm",
                "image": null,
                "type": "Armor",
                "attack": 16,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Carmine Robes",
                "image": null,
                "type": "Armor",
                "attack": 11,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Defense to Scarlett"
            },
            {
                "name": "Castle Rampart",
                "image": null,
                "type": "Armor",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Battle of the Dark Legion",
                "comment": null
            },
            {
                "name": "Chaos Armor",
                "image": null,
                "type": "Armor",
                "attack": 17,
                "defense": 17,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Colossal Armor",
                "image": null,
                "type": "Armor",
                "attack": 2,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Commanders Battle Plate",
                "image": null,
                "type": "Armor",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Crimson Cloak",
                "image": "eq_vincent_armor2.jpg",
                "type": "Armor",
                "attack": 8,
                "defense": 20,
                "hero": "Vincent",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Crusader Armor",
                "image": null,
                "type": "Armor",
                "attack": 8,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Death Ward",
                "image": null,
                "type": "Armor",
                "attack": 12,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 attack to Adriana"
            },
            {
                "name": "Deathrune Hellplate",
                "image": null,
                "type": "Armor",
                "attack": 18,
                "defense": 27,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% critical when Skaar is equipped"
            },
            {
                "name": "Demonic Armor",
                "image": null,
                "type": "Armor",
                "attack": 5,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Divinity Plate",
                "image": null,
                "type": "Armor",
                "attack": 12,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Defense to Gallador"
            },
            {
                "name": "Drakken Plate",
                "image": null,
                "type": "Armor",
                "attack": 10,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 defense to Draconius"
            },
            {
                "name": "Dreadnought Plate",
                "image": null,
                "type": "Armor",
                "attack": 8,
                "defense": 6,
                "hero": "Keira",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Elemental Garb",
                "image": null,
                "type": "Armor",
                "attack": 18,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Elven Plate",
                "image": null,
                "type": "Armor",
                "attack": 6,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Emperion Plate",
                "image": null,
                "type": "Armor",
                "attack": 12,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Defense to Gawain"
            },
            {
                "name": "Empyrean Plate",
                "image": null,
                "type": "Armor",
                "attack": 10,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Epaulets of Might",
                "image": null,
                "type": "Armor",
                "attack": 0,
                "defense": 4,
                "hero": "Elin",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Evergreen Cloak",
                "image": null,
                "type": "Armor",
                "attack": 2,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Faerie Wings",
                "image": null,
                "type": "Armor",
                "attack": 6,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Feral Armor",
                "image": null,
                "type": "Armor",
                "attack": 1,
                "defense": 2,
                "hero": null,
                "recipe1": "Whisper Bow",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Frost Armor",
                "image": null,
                "type": "Armor",
                "attack": 4,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Garlans Battlegear",
                "image": null,
                "type": "Armor",
                "attack": 4,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+5 Defense when Garlan is equipped"
            },
            {
                "name": "Gildamesh's War Plate",
                "image": null,
                "type": "Armor",
                "attack": 5,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Glacial Raiments",
                "image": null,
                "type": "Armor",
                "attack": 11,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gladiator Plate",
                "image": null,
                "type": "Armor",
                "attack": 28,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped from Season 2 Arena, Tier 4 Award, +1% critical when Shino is equipped"
            },
            {
                "name": "Gladiator Raiments",
                "image": null,
                "type": "Armor",
                "attack": 20,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Glorious Plate",
                "image": null,
                "type": "Armor",
                "attack": 20,
                "defense": 31,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Griffinhyde Armor",
                "image": null,
                "type": "Armor",
                "attack": 16,
                "defense": 19,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hellforge Plate",
                "image": null,
                "type": "Armor",
                "attack": 25,
                "defense": 12,
                "hero": null,
                "recipe1": "Volcanic Knight",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hellkite Armor",
                "image": null,
                "type": "Armor",
                "attack": 5,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Holy Plate",
                "image": null,
                "type": "Armor",
                "attack": 18,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hunters Raiments",
                "image": null,
                "type": "Armor",
                "attack": 12,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 defense to Kataan"
            },
            {
                "name": "Infernal Plate",
                "image": null,
                "type": "Armor",
                "attack": 12,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Innocence",
                "image": null,
                "type": "Armor",
                "attack": 14,
                "defense": 22,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Jadan Robes",
                "image": null,
                "type": "Armor",
                "attack": 11,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Defense to Jada"
            },
            {
                "name": "Kromash Karapace",
                "image": "eq_kromash_armor.jpg",
                "type": "Armor",
                "attack": 9,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped by Kromash"
            },
            {
                "name": "Lava Plate",
                "image": null,
                "type": "Armor",
                "attack": 15,
                "defense": 24,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Defense to Sano"
            },
            {
                "name": "Leather Armor",
                "image": null,
                "type": "Armor",
                "attack": 0,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lion Scar Plate",
                "image": null,
                "type": "Armor",
                "attack": 33,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lionheart Plate",
                "image": null,
                "type": "Armor",
                "attack": 10,
                "defense": 25,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lycan Armguard",
                "image": null,
                "type": "Armor",
                "attack": 11,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+0.5% Critical when Fenris is equipped"
            },
            {
                "name": "Magus Plate",
                "image": null,
                "type": "Armor",
                "attack": 15,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Minotaurs Battle Armor",
                "image": null,
                "type": "Armor",
                "attack": 3,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 defense to Karn"
            },
            {
                "name": "Moonfall Battlegear",
                "image": "divinedemi_aurora_armor.jpg",
                "type": "Armor",
                "attack": 10,
                "defense": 26,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Divine Item (Divine Power 10).  Granted at 6500 demi-points with Aurora"
            },
            {
                "name": "Moonfall Robes",
                "image": null,
                "type": "Armor",
                "attack": 15,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Mystic Armor",
                "image": null,
                "type": "Armor",
                "attack": 2,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Mystic Robe",
                "image": "gift_edea2_complete.jpg",
                "type": "Armor",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Gives +3 Defense to Edea"
            },
            {
                "name": "Nightcraft Plate",
                "image": null,
                "type": "Armor",
                "attack": 11,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 defense to Scourge"
            },
            {
                "name": "Obsidian Armor",
                "image": null,
                "type": "Armor",
                "attack": 6,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ogre Raiments",
                "image": null,
                "type": "Armor",
                "attack": 11,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 defense to Gorlak"
            },
            {
                "name": "Overseer Plate",
                "image": null,
                "type": "Armor",
                "attack": 14,
                "defense": 17,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Pauldrons of Light",
                "image": null,
                "type": "Armor",
                "attack": 5,
                "defense": 11,
                "hero": "Leon Ironhart",
                "recipe1": "Holy Plate",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Plate of the Ages",
                "image": null,
                "type": "Armor",
                "attack": 20,
                "defense": 45,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Plate of the Wild",
                "image": null,
                "type": "Armor",
                "attack": 23,
                "defense": 30,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Plated Earth",
                "image": null,
                "type": "Armor",
                "attack": 8,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Platinum Plate",
                "image": null,
                "type": "Armor",
                "attack": 6,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Platinus Armor",
                "image": null,
                "type": "Armor",
                "attack": 9,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 defense to Lailah"
            },
            {
                "name": "Pyromaniac Plate",
                "image": null,
                "type": "Armor",
                "attack": 20,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Raven Cloak",
                "image": null,
                "type": "Armor",
                "attack": 10,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Retribution Plate",
                "image": null,
                "type": "Armor",
                "attack": 8,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 defense to Dexter"
            },
            {
                "name": "Robe of Insight",
                "image": null,
                "type": "Armor",
                "attack": 10,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Robe of the Fang",
                "image": null,
                "type": "Armor",
                "attack": 20,
                "defense": 15,
                "hero": "Aethyx",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Robes of the Tempest",
                "image": null,
                "type": "Armor",
                "attack": 7,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rusty Armor",
                "image": null,
                "type": "Armor",
                "attack": 2,
                "defense": 3,
                "hero": null,
                "recipe1": "Mystic Armor",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Saintly Robes",
                "image": null,
                "type": "Armor",
                "attack": 14,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shadowfel Cloak",
                "image": null,
                "type": "Armor",
                "attack": 16,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shadowsilk Armor",
                "image": null,
                "type": "Armor",
                "attack": 10,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Silverfist Plate",
                "image": null,
                "type": "Armor",
                "attack": 13,
                "defense": 17,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Sophias Battlegarb",
                "image": null,
                "type": "Armor",
                "attack": 4,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+4 Energy when Sophia is equipped"
            },
            {
                "name": "Spellweaver Cloak",
                "image": null,
                "type": "Armor",
                "attack": 13,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Defense to Godric"
            },
            {
                "name": "Steel Chainmail",
                "image": null,
                "type": "Armor",
                "attack": 1,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Steel Plate",
                "image": null,
                "type": "Armor",
                "attack": 2,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Swordsman Battlegear",
                "image": "arena3_armor.jpg",
                "type": "Armor",
                "attack": 10,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Season 3 Arena Tier 2 Award"
            },
            {
                "name": "Swordsmans Plate",
                "image": null,
                "type": "Armor",
                "attack": 25,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped from Season 1 Arena, Tier 2 Award"
            },
            {
                "name": "Tempest Plate",
                "image": null,
                "type": "Armor",
                "attack": 20,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Terran Plate",
                "image": null,
                "type": "Armor",
                "attack": 7,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+8 Health when Darius is equipped"
            },
            {
                "name": "Terrorshard Armor",
                "image": null,
                "type": "Armor",
                "attack": 15,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Vinemenders Armor",
                "image": null,
                "type": "Armor",
                "attack": 20,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Whisper Cloak",
                "image": null,
                "type": "Armor",
                "attack": 6,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Wildwalker Tunic",
                "image": null,
                "type": "Armor",
                "attack": 9,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 defense to Anwar"
            },
            {
                "name": "Zarevok Plate",
                "image": "gift_zarevok_complete.jpg",
                "type": "Armor",
                "attack": 4,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 defense to Zarevok"
            },
            {
                "name": "Zealot Robes",
                "image": null,
                "type": "Armor",
                "attack": 25,
                "defense": 12,
                "hero": null,
                "recipe1": "Blood Zealot",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Zenarean Chainmail",
                "image": null,
                "type": "Armor",
                "attack": 14,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Atlantean Gauntlet",
                "image": "eq_seamonster_gauntlet.jpg",
                "type": "Glove",
                "attack": 4,
                "defense": 4,
                "hero": null,
                "recipe1": "Atlantean Forcefield",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Bladebounrne Gauntlet",
                "image": null,
                "type": "Glove",
                "attack": 10,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% crit when Miri is equipped"
            },
            {
                "name": "Brawler Gloves",
                "image": "arena3_gauntlet.jpg",
                "type": "Glove",
                "attack": 8,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Season 3 Arena Tier 1 Award"
            },
            {
                "name": "Cloudslayer Gauntlet",
                "image": null,
                "type": "Glove",
                "attack": 7,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Defense to Delfina"
            },
            {
                "name": "Crusader Gauntlet",
                "image": null,
                "type": "Glove",
                "attack": 5,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Death Touch Gauntlet",
                "image": null,
                "type": "Glove",
                "attack": 12,
                "defense": 12,
                "hero": null,
                "recipe1": "Soul Crusher",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+5 attack to Lotus Ravenmoore"
            },
            {
                "name": "Fist of Abaddon",
                "image": null,
                "type": "Glove",
                "attack": 12,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Stamina when Mephistopheles is equipped"
            },
            {
                "name": "Gauntlet of Fire",
                "image": null,
                "type": "Glove",
                "attack": 13,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Stamina when Dante is equipped"
            },
            {
                "name": "Gauntlets of Might",
                "image": null,
                "type": "Glove",
                "attack": 2,
                "defense": 2,
                "hero": "Elin",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Stamina when Elin is equipped"
            },
            {
                "name": "Gildamesh's Gauntlet",
                "image": null,
                "type": "Glove",
                "attack": 2,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Golden Hand",
                "image": null,
                "type": "Glove",
                "attack": 2,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Halcyon Glove",
                "image": null,
                "type": "Glove",
                "attack": 8,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Defense to Halycon"
            },
            {
                "name": "Hand of Justice",
                "image": null,
                "type": "Glove",
                "attack": 8,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% critical chance when Azul is equipped"
            },
            {
                "name": "Hand of Life",
                "image": null,
                "type": "Glove",
                "attack": 10,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hand of the Ruler",
                "image": null,
                "type": "Glove",
                "attack": 8,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hand of Valhalla",
                "image": null,
                "type": "Glove",
                "attack": 17,
                "defense": 14,
                "hero": null,
                "recipe1": "Soulbinder",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Hand of Valhalla is also used to create Stormbinder.  This item can be dropped by Agamemnon, the Overseer or created via Alchemy."
            },
            {
                "name": "Hands of Bounty",
                "image": null,
                "type": "Glove",
                "attack": 10,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hands of Darkness",
                "image": null,
                "type": "Glove",
                "attack": 5,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hellforge Gauntlets",
                "image": null,
                "type": "Glove",
                "attack": 14,
                "defense": 6,
                "hero": null,
                "recipe1": "Volcanic Knight",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hellkite Bracer",
                "image": null,
                "type": "Glove",
                "attack": 5,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Holy Gauntlets",
                "image": null,
                "type": "Glove",
                "attack": 4,
                "defense": 6,
                "hero": "Leon Ironhart",
                "recipe1": "Holy Plate",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Icy Handguards",
                "image": null,
                "type": "Glove",
                "attack": 5,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Kromash Krusher",
                "image": "eq_kromash_gauntlet.jpg",
                "type": "Glove",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped by Kromash"
            },
            {
                "name": "Mythril Fists",
                "image": null,
                "type": "Glove",
                "attack": 9,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Stamina when Darius is equipped"
            },
            {
                "name": "Natures Reach",
                "image": null,
                "type": "Glove",
                "attack": 11,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Nightcraft Gauntlets",
                "image": null,
                "type": "Glove",
                "attack": 9,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% crit when Scourge is equipped"
            },
            {
                "name": "Platinum Hands",
                "image": null,
                "type": "Glove",
                "attack": 3,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Poisons Touch",
                "image": null,
                "type": "Glove",
                "attack": 11,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rusty Gloves",
                "image": null,
                "type": "Glove",
                "attack": 1,
                "defense": 1,
                "hero": null,
                "recipe1": "Golden Hand",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Slayer's Embrace",
                "image": null,
                "type": "Glove",
                "attack": 5,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 energy when Slayer is equipped"
            },
            {
                "name": "Soul Crusher",
                "image": null,
                "type": "Glove",
                "attack": 16,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Soul Eater",
                "image": null,
                "type": "Glove",
                "attack": 4,
                "defense": 5,
                "hero": "Cartigan",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Steel Gauntlet",
                "image": null,
                "type": "Glove",
                "attack": 1,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Stormbinder",
                "image": null,
                "type": "Glove",
                "attack": 18,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Stormbringer",
                "image": null,
                "type": "Glove",
                "attack": 18,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Tempered Steel",
                "image": null,
                "type": "Glove",
                "attack": 6,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Tetheryn Glove",
                "image": null,
                "type": "Glove",
                "attack": 7,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% critical chance when Elora is equipped"
            },
            {
                "name": "Timewarp Gauntlet",
                "image": null,
                "type": "Glove",
                "attack": 9,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Virtue of Temperance",
                "image": null,
                "type": "Glove",
                "attack": 6,
                "defense": 14,
                "hero": "Hyperion",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% critical when Hyperion is equipped"
            },
            {
                "name": "Warrior Gauntlet",
                "image": null,
                "type": "Glove",
                "attack": 9,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped from Season 2 Arena, Tier 2 Award, +8 attack when Shino is equipped"
            },
            {
                "name": "Ancient Veil",
                "image": null,
                "type": "Helmet",
                "attack": 9,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Angelic Crown",
                "image": null,
                "type": "Helmet",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Argentum Helm",
                "image": null,
                "type": "Helmet",
                "attack": 9,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Atlantean Helm",
                "image": "eq_seamonster_helm.jpg",
                "type": "Helmet",
                "attack": 4,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Berserker Helm",
                "image": "demi_attack_helm.jpg",
                "type": "Helmet",
                "attack": 12,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Boar Tusk Helm",
                "image": null,
                "type": "Helmet",
                "attack": 7,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Celestial Helm",
                "image": null,
                "type": "Helmet",
                "attack": 11,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Cid Helm",
                "image": "gift_cid2_complete.jpg",
                "type": "Helmet",
                "attack": 3,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Defense to Cid"
            },
            {
                "name": "Cowl of the Avenger",
                "image": null,
                "type": "Helmet",
                "attack": 12,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Crown of Darius",
                "image": null,
                "type": "Helmet",
                "attack": 8,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Stamina when Darius is equipped"
            },
            {
                "name": "Crown of Deliverance",
                "image": null,
                "type": "Helmet",
                "attack": 13,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Crown of Flames",
                "image": null,
                "type": "Helmet",
                "attack": 33,
                "defense": 32,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Crusader Helm",
                "image": null,
                "type": "Helmet",
                "attack": 8,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Demonic Mask",
                "image": null,
                "type": "Helmet",
                "attack": 6,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Devout Helm",
                "image": null,
                "type": "Helmet",
                "attack": 11,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Divinity Helm",
                "image": null,
                "type": "Helmet",
                "attack": 9,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Stamina when Gallador is equipped"
            },
            {
                "name": "Drake Helm",
                "image": null,
                "type": "Helmet",
                "attack": 4,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Deathrune Campaign Raid",
                "comment": null
            },
            {
                "name": "Drakken Helm",
                "image": null,
                "type": "Helmet",
                "attack": 8,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 energy when Draconius is equipped"
            },
            {
                "name": "Dreadnought Horns",
                "image": null,
                "type": "Helmet",
                "attack": 6,
                "defense": 3,
                "hero": "Keira",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Elven Crown",
                "image": "eq_sylvanus_crown.jpg",
                "type": "Helmet",
                "attack": 5,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Elven Crown",
                "image": "gift_aeris_complete.jpg",
                "type": "Helmet",
                "attack": 2,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+4 Defense when Aeris is equipped"
            },
            {
                "name": "Emperion Helm",
                "image": null,
                "type": "Helmet",
                "attack": 12,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Stamina when Gawain is equipped"
            },
            {
                "name": "Frost Helm",
                "image": null,
                "type": "Helmet",
                "attack": 7,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Galvanized Helm",
                "image": null,
                "type": "Helmet",
                "attack": 11,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Defense to Garlan"
            },
            {
                "name": "Gildamesh's War Helm",
                "image": null,
                "type": "Helmet",
                "attack": 6,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gilded Tiara",
                "image": null,
                "type": "Helmet",
                "attack": 10,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 defense to Suri"
            },
            {
                "name": "Glacial Helm",
                "image": null,
                "type": "Helmet",
                "attack": 10,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 energy when Lilith & Riku is equipped"
            },
            {
                "name": "Guardian Helm",
                "image": null,
                "type": "Helmet",
                "attack": 10,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Helm of Dragon Power",
                "image": null,
                "type": "Helmet",
                "attack": 30,
                "defense": 30,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Helm of Fear",
                "image": null,
                "type": "Helmet",
                "attack": 9,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "High Kings Crown",
                "image": null,
                "type": "Helmet",
                "attack": 11,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Infernal Helmet",
                "image": null,
                "type": "Helmet",
                "attack": 11,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Kromash Krown",
                "image": "eq_kromash_helm.jpg",
                "type": "Helmet",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped by Kromash"
            },
            {
                "name": "Lifegiver Helm",
                "image": null,
                "type": "Helmet",
                "attack": 13,
                "defense": 17,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lion Scar Helm",
                "image": null,
                "type": "Helmet",
                "attack": 9,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lionheart Helm",
                "image": null,
                "type": "Helmet",
                "attack": 4,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Mane of Maalvus",
                "image": null,
                "type": "Helmet",
                "attack": 15,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Mask of Agamemnon",
                "image": null,
                "type": "Helmet",
                "attack": 32,
                "defense": 29,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Moonfall Crown",
                "image": null,
                "type": "Helmet",
                "attack": 6,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Nightcraft Helm",
                "image": null,
                "type": "Helmet",
                "attack": 9,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Stamina when Scourge is equipped"
            },
            {
                "name": "Obsidian Helmet",
                "image": null,
                "type": "Helmet",
                "attack": 3,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Retribution Helm",
                "image": null,
                "type": "Helmet",
                "attack": 9,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "damage received reduced by 1 when Dexter is equipped"
            },
            {
                "name": "Righteous Helm",
                "image": null,
                "type": "Helmet",
                "attack": 28,
                "defense": 30,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rusted Helm",
                "image": null,
                "type": "Helmet",
                "attack": 3,
                "defense": 2,
                "hero": null,
                "recipe1": "Drake Helm",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Deathrune Campaign Raid",
                "comment": "Piece is used to create Drake Helm which in turn summons Deathrune Campaign Raid"
            },
            {
                "name": "Silverfist Helm",
                "image": null,
                "type": "Helmet",
                "attack": 11,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Spartan Helm",
                "image": null,
                "type": "Helmet",
                "attack": 1,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Steel Helm",
                "image": null,
                "type": "Helmet",
                "attack": 1,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Swordsman Helm",
                "image": null,
                "type": "Helmet",
                "attack": 15,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Season 2 Arena, Tier 1 Award, +3 stamina when Shino is equipped"
            },
            {
                "name": "Tempest Crown",
                "image": null,
                "type": "Helmet",
                "attack": 3,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Tempest Helm",
                "image": null,
                "type": "Helmet",
                "attack": 10,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Terra's Crown",
                "image": null,
                "type": "Helmet",
                "attack": 10,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 energy to Terra"
            },
            {
                "name": "Thornguard Helm",
                "image": null,
                "type": "Helmet",
                "attack": 18,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Titan Helm",
                "image": null,
                "type": "Helmet",
                "attack": 11,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Max Stamina to player when Minerva is equipped"
            },
            {
                "name": "Tyrant Crown",
                "image": null,
                "type": "Helmet",
                "attack": 22,
                "defense": 20,
                "hero": null,
                "recipe1": "Crown of Flames",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Vanguard Doomhelm",
                "image": "arena3_helm.jpg",
                "type": "Helmet",
                "attack": 45,
                "defense": 45,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Arena Season 3, Tier 6 Reward"
            },
            {
                "name": "Vanguard Helm",
                "image": null,
                "type": "Helmet",
                "attack": 35,
                "defense": 35,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Season 2 Arena, Tier 6 Award."
            },
            {
                "name": "Virtue of Fortitude",
                "image": null,
                "type": "Helmet",
                "attack": 14,
                "defense": 32,
                "hero": "Hyperion",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Defense to Hyperion"
            },
            {
                "name": "Volcanic Helm",
                "image": null,
                "type": "Helmet",
                "attack": 32,
                "defense": 14,
                "hero": null,
                "recipe1": "Volcanic Knight",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Windchaser Helm",
                "image": null,
                "type": "Helmet",
                "attack": 29,
                "defense": 29,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Windstalker Crown",
                "image": null,
                "type": "Helmet",
                "attack": 10,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Energy when Zin is equipped"
            },
            {
                "name": "Windswept Crown",
                "image": null,
                "type": "Helmet",
                "attack": 8,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% crit when Kaylen is equipped"
            },
            {
                "name": "Wolf Helm",
                "image": null,
                "type": "Helmet",
                "attack": 2,
                "defense": 1,
                "hero": null,
                "recipe1": "Whisper Bow",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Wrathbringer Helm",
                "image": null,
                "type": "Helmet",
                "attack": 12,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% crit when Barbarus is equipped"
            },
            {
                "name": "Angel Fire",
                "image": null,
                "type": "Magic",
                "attack": 8,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Angelic Blessing",
                "image": "magic_divine_blessings.jpg",
                "type": "Magic",
                "attack": 0,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Battle of the Dark Legion",
                "comment": null
            },
            {
                "name": "Angelic Rebirth",
                "image": null,
                "type": "Magic",
                "attack": 17,
                "defense": 17,
                "hero": null,
                "recipe1": "Transcendence",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Azriel"
            },
            {
                "name": "Angels Crusade",
                "image": null,
                "type": "Magic",
                "attack": 6,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Arachnid Poison",
                "image": null,
                "type": "Magic",
                "attack": 5,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Arcane Blast",
                "image": "war_reward_3.jpg",
                "type": "Magic",
                "attack": 4,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Arcane Vortex",
                "image": null,
                "type": "Magic",
                "attack": 15,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Atlantean Forcefield",
                "image": "eq_seamonster_magic.jpg",
                "type": "Magic",
                "attack": 10,
                "defense": 17,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Avengers Oath",
                "image": "demi_stamina_spell.jpg",
                "type": "Magic",
                "attack": 5,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Backdraft",
                "image": null,
                "type": "Magic",
                "attack": 12,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% critical when Kaiser is equipped"
            },
            {
                "name": "Berserker Frenzy",
                "image": "demi_attack_spell.jpg",
                "type": "Magic",
                "attack": 6,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Binding Will",
                "image": null,
                "type": "Magic",
                "attack": 14,
                "defense": 15,
                "hero": "Shivak",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Blessing of Nature",
                "image": "demi_aur_8.jpg",
                "type": "Magic",
                "attack": 12,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Breath of Fire",
                "image": null,
                "type": "Magic",
                "attack": 15,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Dante"
            },
            {
                "name": "Champions Aura",
                "image": null,
                "type": "Magic",
                "attack": 3,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Colossal Orb",
                "image": null,
                "type": "Magic",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Colossus of Terra",
                "comment": null
            },
            {
                "name": "Consecration",
                "image": null,
                "type": "Magic",
                "attack": 14,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Deadly Strike",
                "image": null,
                "type": "Magic",
                "attack": 2,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Demon Strength",
                "image": null,
                "type": "Magic",
                "attack": 8,
                "defense": 2,
                "hero": "Keira",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Demonic Circle",
                "image": null,
                "type": "Magic",
                "attack": 9,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Discombobulate",
                "image": null,
                "type": "Magic",
                "attack": 13,
                "defense": 17,
                "hero": "Syren",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Divine Blast",
                "image": null,
                "type": "Magic",
                "attack": 32,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dragon Charm",
                "image": "dragon_charm_spell.jpg",
                "type": "Magic",
                "attack": 3,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Empowering Storm",
                "image": "eq_kromash_spell.jpg",
                "type": "Magic",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped by Kromash"
            },
            {
                "name": "Energy Bolt",
                "image": "magic_energybolt.jpg",
                "type": "Magic",
                "attack": 1,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Fireball",
                "image": "magic_fireball.jpg",
                "type": "Magic",
                "attack": 5,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Frost Bolt",
                "image": null,
                "type": "Magic",
                "attack": 12,
                "defense": 25,
                "hero": "Medius",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Defense to Medius"
            },
            {
                "name": "Gladiator Strength",
                "image": null,
                "type": "Magic",
                "attack": 25,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Arena Season 1, Tier 4 Award"
            },
            {
                "name": "Gladiators Strength",
                "image": null,
                "type": "Magic",
                "attack": 25,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Greater Fireball",
                "image": "magic_fireball.jpg",
                "type": "Magic",
                "attack": 6,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Helenas Inferno",
                "image": null,
                "type": "Magic",
                "attack": 8,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hellkite Flames",
                "image": null,
                "type": "Magic",
                "attack": 8,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Heroic Inspiration",
                "image": "arena3_spell.jpg",
                "type": "Magic",
                "attack": 25,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Arena Season 3, Tier 5 Award"
            },
            {
                "name": "Heros Resolve",
                "image": null,
                "type": "Magic",
                "attack": 2,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Battle of the Dark Legion",
                "comment": null
            },
            {
                "name": "Holy Aura",
                "image": null,
                "type": "Magic",
                "attack": 10,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Holy Shield",
                "image": "demi_defense_spell.jpg",
                "type": "Magic",
                "attack": 4,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Holy Smite",
                "image": null,
                "type": "Magic",
                "attack": 12,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Immolation",
                "image": null,
                "type": "Magic",
                "attack": 10,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Dante"
            },
            {
                "name": "Invulnerability",
                "image": null,
                "type": "Magic",
                "attack": 5,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lava Inferno",
                "image": null,
                "type": "magic",
                "attack": 35,
                "defense": 19,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Divine Power: 40"
            },
            {
                "name": "Lightning Bolt",
                "image": "magic_lightning.jpg",
                "type": "Magic",
                "attack": 8,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lightning Storm",
                "image": "lightning_storm.jpg",
                "type": "Magic",
                "attack": 15,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lotus Orb",
                "image": null,
                "type": "Magic",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Lotus",
                "comment": null
            },
            {
                "name": "Maelstrom",
                "image": "magic_maelstrom.jpg",
                "type": "Magic",
                "attack": 7,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Maelstrom",
                "image": "eq_valhalla_spell.jpg",
                "type": "Magic",
                "attack": 16,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Magic Missile",
                "image": "magic_magic_missile.jpg",
                "type": "Magic",
                "attack": 1,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Mark of the Wolf",
                "image": null,
                "type": "Magic",
                "attack": 6,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Energy when Darius is equipped"
            },
            {
                "name": "Mind Control",
                "image": null,
                "type": "Magic",
                "attack": 9,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 defense to Aria"
            },
            {
                "name": "Moonfall Aura",
                "image": "demi_health_spell.jpg",
                "type": "Magic",
                "attack": 4,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Natures Sunder",
                "image": null,
                "type": "Magic",
                "attack": 15,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Necronic Blast",
                "image": null,
                "type": "Magic",
                "attack": 18,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Orb of Alpha Mephistopheles",
                "image": null,
                "type": "Magic",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Alpha Mephistopheles",
                "comment": null
            },
            {
                "name": "Orb of Aurelius",
                "image": null,
                "type": "Magic",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Lion's Rebellion",
                "comment": null
            },
            {
                "name": "Orb of Aurora",
                "image": "boss_aurora_orb.jpg",
                "type": "Magic",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Aurora",
                "comment": null
            },
            {
                "name": "Orb of Azriel",
                "image": null,
                "type": "Magic",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Azriel",
                "comment": null
            },
            {
                "name": "Orb of Corvintheus",
                "image": "orb_corvintheus.jpg",
                "type": "Magic",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Corvintheus",
                "comment": null
            },
            {
                "name": "Orb of Gildamesh",
                "image": null,
                "type": "Magic",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Gildamesh",
                "comment": null
            },
            {
                "name": "Orb of Jahanna",
                "image": "boss_jahanna_orb.jpg",
                "type": "Magic",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Jahanna",
                "comment": null
            },
            {
                "name": "Orb of Keira",
                "image": null,
                "type": "Magic",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Keira",
                "comment": null
            },
            {
                "name": "Orb of Mephistopheles",
                "image": null,
                "type": "Magic",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Mephistopheles",
                "comment": null
            },
            {
                "name": "Orb of Skaar Deathrune",
                "image": null,
                "type": "Magic",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Skaar Deathrune",
                "comment": null
            },
            {
                "name": "Pestilence",
                "image": null,
                "type": "Magic",
                "attack": 7,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Redeeming Light",
                "image": null,
                "type": "Magic",
                "attack": 3,
                "defense": 5,
                "hero": "Strider",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Royal Seal",
                "image": null,
                "type": "Magic",
                "attack": 5,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shadow Blast",
                "image": null,
                "type": "Magic",
                "attack": 5,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Attack to Morrigan"
            },
            {
                "name": "Skullfire",
                "image": null,
                "type": "Magic",
                "attack": 16,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Solar Desolation",
                "image": null,
                "type": "Magic",
                "attack": 13,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Stone Skin",
                "image": null,
                "type": "Magic",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Strangling Vines",
                "image": null,
                "type": "Magic",
                "attack": 15,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Swarm of Darkness",
                "image": null,
                "type": "Magic",
                "attack": 20,
                "defense": 16,
                "hero": "Vincent",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": " ",
                "comment": "Sometimes dropped after slaying Vincent or Alpha Vincent"
            },
            {
                "name": "Sylvanas Orb",
                "image": null,
                "type": "Magic",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Sylvanas",
                "comment": null
            },
            {
                "name": "Tempest Storm",
                "image": "demi_energy_spell.jpg",
                "type": "Magic",
                "attack": 17,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Time Shift",
                "image": null,
                "type": "Magic",
                "attack": 9,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Stamina when Godric is equipped"
            },
            {
                "name": "Wall of Fire",
                "image": "dragon_reward_fire.jpg",
                "type": "Magic",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": "Helm of Dragon Power",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Whirlwind",
                "image": null,
                "type": "Magic",
                "attack": 28,
                "defense": 17,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Wolf Spirit",
                "image": "magic_wolf.jpg",
                "type": "Magic",
                "attack": 7,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Wrath of Vanquish",
                "image": null,
                "type": "Magic",
                "attack": 4,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Vanquish"
            },
            {
                "name": "Absolution",
                "image": null,
                "type": "Shield",
                "attack": 13,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Defense to Azul"
            },
            {
                "name": "Aegis of Earth",
                "image": "eq_darius_shield.jpg",
                "type": "Shield",
                "attack": 9,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Defense to Darius"
            },
            {
                "name": "Aegis of Kings",
                "image": null,
                "type": "Shield",
                "attack": 50,
                "defense": 40,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "This is a divine item, must be level 175 to create.  Divine power: 120"
            },
            {
                "name": "Aegis of the Tower",
                "image": null,
                "type": "Shield",
                "attack": 22,
                "defense": 26,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Sometimes dropped by Agamemnon, the Overseer. Used to create the Aegis of Kings (Divine Power 120, must be level 175 to create)."
            },
            {
                "name": "Aegis of the Winds",
                "image": null,
                "type": "Shield",
                "attack": 28,
                "defense": 22,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ancient Shield",
                "image": null,
                "type": "Shield",
                "attack": 12,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Defense to Zin"
            },
            {
                "name": "Ancient Tome",
                "image": null,
                "type": "Shield",
                "attack": 7,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 defense to Lyra"
            },
            {
                "name": "Atlantean Shield",
                "image": "eq_seamonster_shield.jpg",
                "type": "Shield",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": "Atlantean Forcefield",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Berserker Shield",
                "image": "demi_attack_shield.jpg",
                "type": "Shield",
                "attack": 3,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Buckler",
                "image": "eq_buckler.jpg",
                "type": "Shield",
                "attack": 0,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Conflagration Shield",
                "image": "gift_araxis2_complete.jpg",
                "type": "Shield",
                "attack": 7,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Gives +1 Defense to Araxis, Obtained from Mystery Shield gifts"
            },
            {
                "name": "Crest of the Griffin",
                "image": null,
                "type": "Shield",
                "attack": 15,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Crusader Shield",
                "image": null,
                "type": "Shield",
                "attack": 9,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Deathshield",
                "image": "eq_death_epic_shield.jpg",
                "type": "Shield",
                "attack": 24,
                "defense": 24,
                "hero": " ",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 stamina when Skaar is equipped"
            },
            {
                "name": "Defender",
                "image": "eq_leon_shield.jpg",
                "type": "Shield",
                "attack": 7,
                "defense": 10,
                "hero": "Leon Ironhart",
                "recipe1": "Holy Plate",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Defender of the Wild",
                "image": null,
                "type": "Shield",
                "attack": 24,
                "defense": 26,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dragan Protector",
                "image": "gift_dragan_complete.jpg",
                "type": "Shield",
                "attack": 5,
                "defense": 9,
                "hero": "Dragan",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+5 Defense when Dragan is equipped"
            },
            {
                "name": "Dragon Scale",
                "image": null,
                "type": "Shield",
                "attack": 4,
                "defense": 9,
                "hero": null,
                "recipe1": "Helm of Dragon Power",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Feral Staff",
                "image": null,
                "type": "Shield",
                "attack": 2,
                "defense": 2,
                "hero": null,
                "recipe1": "Whisper Bow",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Forsaken Tome",
                "image": null,
                "type": "Shield",
                "attack": 13,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Frost Tear Dagger",
                "image": null,
                "type": "Shield",
                "attack": 5,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Harmony",
                "image": null,
                "type": "Shield",
                "attack": 8,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "damage received reduced by 1 when Lailah is equipped"
            },
            {
                "name": "Heart of the Pride",
                "image": null,
                "type": "Shield",
                "attack": 20,
                "defense": 44,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hellcore Defender",
                "image": null,
                "type": "Shield",
                "attack": 18,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hellkite Shield",
                "image": "eq_mephisto_shield.jpg",
                "type": "Shield",
                "attack": 2,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Honors Defender",
                "image": null,
                "type": "Shield",
                "attack": 25,
                "defense": 30,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hour Glass",
                "image": null,
                "type": "Shield",
                "attack": 0,
                "defense": 0,
                "hero": null,
                "recipe1": "Morningstar",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ice Dagger",
                "image": null,
                "type": "Shield",
                "attack": 2,
                "defense": 2,
                "hero": null,
                "recipe1": "Frost Tear Dagger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Illvasan Crest",
                "image": null,
                "type": "Shield",
                "attack": 10,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 defense to Minerva"
            },
            {
                "name": "Inferno Shield",
                "image": "eq_volcanic_weapon2.jpg",
                "type": "Shield",
                "attack": 15,
                "defense": 10,
                "hero": null,
                "recipe1": "Volcanic Knight",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Juggernaut Shield",
                "image": null,
                "type": "Shield",
                "attack": 18,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lionheart Shield",
                "image": null,
                "type": "Shield",
                "attack": 7,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Moonfall Shield",
                "image": null,
                "type": "Shield",
                "attack": 10,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Nether Tome",
                "image": "gift_morrigan2_complete.jpg",
                "type": "Shield",
                "attack": 6,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Gives +3 Defense to Morrigan.  Obtained from Mystery Tome Gifts."
            },
            {
                "name": "Obsidian Shield",
                "image": null,
                "type": "Shield",
                "attack": 4,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Purgatory",
                "image": null,
                "type": "Shield",
                "attack": 30,
                "defense": 30,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Seraphim Shield",
                "image": null,
                "type": "Shield",
                "attack": 11,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Defense to Solara"
            },
            {
                "name": "Serenes Arrow",
                "image": null,
                "type": "Shield",
                "attack": 1,
                "defense": 1,
                "hero": "Serene",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% Critical when Serene is equipped"
            },
            {
                "name": "Serpentine Shield",
                "image": "alchemy_serpent_done.jpg",
                "type": "Shield",
                "attack": 4,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "Cronus, The World Hydra",
                "comment": null
            },
            {
                "name": "Shield of Arielle",
                "image": null,
                "type": "Shield",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Defense to Arielle"
            },
            {
                "name": "Shield of Artanis",
                "image": null,
                "type": "Shield",
                "attack": 7,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shield of Dante",
                "image": "eq_dante_shield_complete.jpg",
                "type": "Shield",
                "attack": 4,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Defense when Dante is equipped"
            },
            {
                "name": "Shield of Might",
                "image": "eq_elin_shield.jpg",
                "type": "Shield",
                "attack": 1,
                "defense": 3,
                "hero": "Elin",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Defense to Elin"
            },
            {
                "name": "Silverlight Tome",
                "image": "eq_gift_elizabeth2_complete.jpg",
                "type": "Shield",
                "attack": 3,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Defense to Elizabeth Lione"
            },
            {
                "name": "Spartan Shield",
                "image": "eq_spartan_shield.jpg",
                "type": "Shield",
                "attack": 0,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Star Shield",
                "image": null,
                "type": "Shield",
                "attack": 7,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Steel Shield",
                "image": null,
                "type": "Shield",
                "attack": 1,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Storm Buckler",
                "image": "eq_kromash_shield.jpg",
                "type": "Shield",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Shield of Storms",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Dropped by Kromash"
            },
            {
                "name": "Sword of Redemption",
                "image": null,
                "type": "Shield",
                "attack": 50,
                "defense": 30,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Tempest Shield",
                "image": null,
                "type": "Shield",
                "attack": 4,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Terra's Guard",
                "image": null,
                "type": "Shield",
                "attack": 10,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 defense to Terra"
            },
            {
                "name": "The Dreadnought",
                "image": "boss_keira_shield.jpg",
                "type": "Shield",
                "attack": 3,
                "defense": 7,
                "hero": "Keira",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Vindicator Shield",
                "image": null,
                "type": "Shield",
                "attack": 11,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Defense to Crissana"
            },
            {
                "name": "Warmonger Shield",
                "image": null,
                "type": "Shield",
                "attack": 12,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Barbarus"
            },
            {
                "name": "Zarevok Defender",
                "image": null,
                "type": "Shield",
                "attack": 5,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Zenarean Crest",
                "image": null,
                "type": "Shield",
                "attack": 4,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": "War of the Red Plains",
                "comment": null
            },
            {
                "name": "Air Elemental",
                "image": "soldier_lightning.jpg",
                "type": "Soldier",
                "attack": 14,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Alpha Amethyst Serpent",
                "image": null,
                "type": "Soldier",
                "attack": 75,
                "defense": 75,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Alpha Emerald Serpent",
                "image": null,
                "type": "Soldier",
                "attack": 65,
                "defense": 65,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Alpha Ragnarok",
                "image": null,
                "type": "Soldier",
                "attack": 110,
                "defense": 110,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Alpha Red Serpent",
                "image": null,
                "type": "Soldier",
                "attack": 80,
                "defense": 80,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Alpha Sapphire Serpent",
                "image": null,
                "type": "Soldier",
                "attack": 70,
                "defense": 70,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Angel",
                "image": "upgrade_angel.gif",
                "type": "Soldier",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Angelic Sentinel",
                "image": "soldier_angelic_sentinel.jpg",
                "type": "Soldier",
                "attack": 20,
                "defense": 24,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Arcanist",
                "image": "soldier_arcanis.jpg",
                "type": "Soldier",
                "attack": 23,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Archangel",
                "image": "archangel.jpg",
                "type": "Soldier",
                "attack": 25,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Armored Spider",
                "image": null,
                "type": "Soldier",
                "attack": 7,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Atlantean Archer",
                "image": "soldier_a_archer.jpg",
                "type": "Soldier",
                "attack": 12,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Bahamut, the Volcanic Dragon",
                "image": null,
                "type": "Soldier",
                "attack": 75,
                "defense": 75,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Barbarian",
                "image": "soldier_barbarian.jpg",
                "type": "Soldier",
                "attack": 10,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Barbarian Captain",
                "image": "war_reward_2.jpg",
                "type": "Soldier",
                "attack": 23,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Black Knight",
                "image": "soldier_knight_160.jpg",
                "type": "Soldier",
                "attack": 5,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Blood Zealot",
                "image": null,
                "type": "Soldier",
                "attack": 40,
                "defense": 40,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Cleric",
                "image": "upgrade_cleric.jpg",
                "type": "Soldier",
                "attack": 1,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Cronus, The World Hydra",
                "image": "soldier_hydra_final.jpg",
                "type": "Soldier",
                "attack": 60,
                "defense": 60,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Death Knight",
                "image": "soldier_deathknight.jpg",
                "type": "Soldier",
                "attack": 9,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Demonic Stalker",
                "image": "soldier_demonic_stalker.jpg",
                "type": "Soldier",
                "attack": 25,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dragon",
                "image": "upgrade_dragon.jpg",
                "type": "Soldier",
                "attack": 16,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dwarven Battlemaster",
                "image": "soldier_battlemaster.jpg",
                "type": "Soldier",
                "attack": 9,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dwarven Sentry",
                "image": null,
                "type": "Soldier",
                "attack": 29,
                "defense": 33,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Earth Bandit",
                "image": null,
                "type": "Soldier",
                "attack": 2,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Elven Blade",
                "image": null,
                "type": "Soldier",
                "attack": 14,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Entangling Spider",
                "image": null,
                "type": "Soldier",
                "attack": 9,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Fire Elemental",
                "image": "soldier_fire_elemental.jpg",
                "type": "Soldier",
                "attack": 8,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Flame Invoker",
                "image": "soldier_gehenna.jpg",
                "type": "Soldier",
                "attack": 55,
                "defense": 45,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Footman",
                "image": "upgrade_footmen.jpg",
                "type": "Soldier",
                "attack": 1,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Frost Tiger",
                "image": null,
                "type": "Soldier",
                "attack": 26,
                "defense": 30,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gehenna",
                "image": "arena3_gehenna.jpg",
                "type": "Soldier",
                "attack": 110,
                "defense": 110,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Genesis, The Earth Elemental",
                "image": null,
                "type": "Soldier",
                "attack": 100,
                "defense": 100,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Arena Season 1, Tier 6 Award."
            },
            {
                "name": "Gift Angel",
                "image": "upgrade_angel.gif",
                "type": "Soldier",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gift Cleric",
                "image": "upgrade_cleric.jpg",
                "type": "Soldier",
                "attack": 1,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gift Dragon",
                "image": "upgrade_dragon.jpg",
                "type": "Soldier",
                "attack": 16,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gift Footman",
                "image": "upgrade_footmen.jpg",
                "type": "Soldier",
                "attack": 1,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gift Knight",
                "image": "upgrade_knight.jpg",
                "type": "Soldier",
                "attack": 3,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gift Paladin",
                "image": "upgrade_paladin.jpg",
                "type": "Soldier",
                "attack": 3,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gift Phoenix",
                "image": "upgrade_phoenix.jpg",
                "type": "Soldier",
                "attack": 20,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gift Ranger",
                "image": "upgrade_ranger.gif",
                "type": "Soldier",
                "attack": 2,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gift Tree Ent",
                "image": "upgrade_tree.jpg",
                "type": "Soldier",
                "attack": 4,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gift Wizard",
                "image": "upgrade_wizard.jpg",
                "type": "Soldier",
                "attack": 3,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gladiator",
                "image": "soldier_volcanic_gladiator.jpg",
                "type": "Soldier",
                "attack": 35,
                "defense": 24,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Golden Fang",
                "image": null,
                "type": "Soldier",
                "attack": 14,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Greater Werewolf",
                "image": "soldier_werewolf.jpg",
                "type": "Soldier",
                "attack": 27,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Griffin",
                "image": "soldier_griffin_160.jpg",
                "type": "Soldier",
                "attack": 6,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Griffin Rider",
                "image": null,
                "type": "Soldier",
                "attack": 33,
                "defense": 29,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hellkite Minion",
                "image": "soldier_hellkite.jpg",
                "type": "Soldier",
                "attack": 32,
                "defense": 27,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hellslayer Knight",
                "image": "solider_hellslayer.jpg",
                "type": "Soldier",
                "attack": 29,
                "defense": 33,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hydra: Atlas",
                "image": "soldier_hydra_2.jpg",
                "type": "Soldier",
                "attack": 23,
                "defense": 28,
                "hero": null,
                "recipe1": "Cronus, The World Hydra",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hydra: Epimetheus",
                "image": "soldier_hydra_4.jpg",
                "type": "Soldier",
                "attack": 18,
                "defense": 24,
                "hero": null,
                "recipe1": "Cronus, The World Hydra",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hydra: Prometheus",
                "image": "soldier_hydra_1.jpg",
                "type": "Soldier",
                "attack": 35,
                "defense": 25,
                "hero": null,
                "recipe1": "Cronus, The World Hydra",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hydra: Rhea",
                "image": "soldier_hydra_5.jpg",
                "type": "Soldier",
                "attack": 24,
                "defense": 18,
                "hero": null,
                "recipe1": "Cronus, The World Hydra",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hydra: Tethys",
                "image": "soldier_hydra_3.jpg",
                "type": "Soldier",
                "attack": 21,
                "defense": 21,
                "hero": null,
                "recipe1": "Cronus, The World Hydra",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Illvasan Elite",
                "image": null,
                "type": "Soldier",
                "attack": 27,
                "defense": 32,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Knight",
                "image": "upgrade_knight.jpg",
                "type": "Soldier",
                "attack": 3,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lich",
                "image": "soldier_lich.jpg",
                "type": "Soldier",
                "attack": 7,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Maiden Shadow",
                "image": null,
                "type": "Soldier",
                "attack": 16,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Mercenary",
                "image": "soldier_mercenary.jpg",
                "type": "Soldier",
                "attack": 5,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Monk Warrior",
                "image": null,
                "type": "Soldier",
                "attack": 30,
                "defense": 30,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ogre",
                "image": null,
                "type": "Soldier",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Orc Champion",
                "image": "soldier_orc_champion.jpg",
                "type": "Soldier",
                "attack": 50,
                "defense": 50,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Orc Chieftain",
                "image": null,
                "type": "Soldier",
                "attack": 26,
                "defense": 26,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Orc Grunt",
                "image": "soldier_orc.jpg",
                "type": "Soldier",
                "attack": 7,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Orc Marauder",
                "image": null,
                "type": "Soldier",
                "attack": 32,
                "defense": 27,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Paladin",
                "image": "upgrade_paladin.jpg",
                "type": "Soldier",
                "attack": 3,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Phantasm",
                "image": null,
                "type": "Soldier",
                "attack": 14,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Phoenix",
                "image": null,
                "type": "Soldier",
                "attack": 20,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Platinum Knight",
                "image": "soldier_heaven.jpg",
                "type": "Soldier",
                "attack": 23,
                "defense": 27,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Poisonous Spider",
                "image": null,
                "type": "Soldier",
                "attack": 14,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ragnarok",
                "image": null,
                "type": "Soldier",
                "attack": 105,
                "defense": 105,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ranger",
                "image": "upgrade_ranger.gif",
                "type": "Soldier",
                "attack": 2,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rogue Assassin",
                "image": "soldier_rogue.jpg",
                "type": "Soldier",
                "attack": 34,
                "defense": 24,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Seraphim Angel",
                "image": "soldier_seraphim.jpg",
                "type": "Soldier",
                "attack": 24,
                "defense": 21,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shadow",
                "image": "soldier_shadow.jpg",
                "type": "Soldier",
                "attack": 7,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shadow Assassin",
                "image": null,
                "type": "Soldier",
                "attack": 15,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shadow Panther",
                "image": null,
                "type": "Soldier",
                "attack": 15,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shadow Warrior",
                "image": null,
                "type": "Soldier",
                "attack": 7,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shadow Wraith",
                "image": null,
                "type": "Soldier",
                "attack": 13,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Skeleton Knight",
                "image": "soldier_skeleton_knight.jpg",
                "type": "Soldier",
                "attack": 18,
                "defense": 27,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Skeleton Warrior",
                "image": "soldier_skeleton.jpg",
                "type": "Soldier",
                "attack": 4,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Spartan Phalanx",
                "image": null,
                "type": "Soldier",
                "attack": 70,
                "defense": 70,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Spartan Warrior",
                "image": "soldier_spartan.jpg",
                "type": "Soldier",
                "attack": 2,
                "defense": 1,
                "hero": null,
                "recipe1": "Spartan Phalanx",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Succubus",
                "image": "soldier_succubus.jpg",
                "type": "Soldier",
                "attack": 19,
                "defense": 17,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Sun Eagle",
                "image": "soldier_eagle.jpg",
                "type": "Soldier",
                "attack": 15,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Tempest Elemental",
                "image": null,
                "type": "Soldier",
                "attack": 55,
                "defense": 50,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Templar Knight",
                "image": null,
                "type": "Soldier",
                "attack": 15,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Tree Ent",
                "image": null,
                "type": "Soldier",
                "attack": 4,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Valerian Assassin",
                "image": "soldier_assassin_1.jpg",
                "type": "Soldier",
                "attack": 1,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Valerian Guard",
                "image": "soldier_guard.jpg",
                "type": "Soldier",
                "attack": 7,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Valerian Mystic",
                "image": "eq_valerian_mystic.jpg",
                "type": "Soldier",
                "attack": 11,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Valhalla the Air Elemental",
                "image": null,
                "type": "Soldier",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Valor Knight",
                "image": "redknight.jpg",
                "type": "Soldier",
                "attack": 22,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Vampire",
                "image": "soldier_vampire.jpg",
                "type": "Soldier",
                "attack": 8,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Vampire Lord",
                "image": "soldier_vampire2.jpg",
                "type": "Soldier",
                "attack": 20,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Volcanic Knight",
                "image": null,
                "type": "Soldier",
                "attack": 65,
                "defense": 55,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "War Bear",
                "image": "soldier_bear.jpg",
                "type": "Soldier",
                "attack": 5,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "War Lion",
                "image": "soldier_lion_160.jpg",
                "type": "Soldier",
                "attack": 6,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Water Demon",
                "image": "soldier_assassin_4.jpg",
                "type": "Soldier",
                "attack": 14,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Water Elemental",
                "image": "soldier_water_elemental.jpg",
                "type": "Soldier",
                "attack": 14,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Water Sprite",
                "image": "soldier_water_sprite.jpg",
                "type": "Soldier",
                "attack": 6,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Willow Wisp",
                "image": "soldier_wisp.jpg",
                "type": "Soldier",
                "attack": 4,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Wizard",
                "image": "upgrade_wizard.jpg",
                "type": "Soldier",
                "attack": 3,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Aeris Dagger",
                "image": "gift_aeris2_complete.jpg",
                "type": "Weapon",
                "attack": 4,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+5 Attack to Aeris"
            },
            {
                "name": "Arachnid Claw",
                "image": null,
                "type": "Weapon",
                "attack": 5,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Arachnid Slayer",
                "image": null,
                "type": "Weapon",
                "attack": 6,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Araxin Blade",
                "image": "gift_araxis_complete.jpg",
                "type": "Weapon",
                "attack": 7,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Bonus: +1 Attack to Araxis"
            },
            {
                "name": "Arctic Blade",
                "image": "eq_water_rare_dagger.jpg",
                "type": "Weapon",
                "attack": 9,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Assassins Blade",
                "image": "eq_strider_complete.jpg",
                "type": "Weapon",
                "attack": 7,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Attack to Strider"
            },
            {
                "name": "Atlantean Mace",
                "image": "eq_seamonster_mace.jpg",
                "type": "Weapon",
                "attack": 6,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Atlantean Spear",
                "image": "eq_seamonster_spear.jpg",
                "type": "Weapon",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": "Atlantean Forcefield",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Atlantean Sword",
                "image": "eq_seamonster_sword.jpg",
                "type": "Weapon",
                "attack": 7,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Atonement",
                "image": null,
                "type": "Weapon",
                "attack": 14,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Azul"
            },
            {
                "name": "Avenger",
                "image": "eq_castle_axe2.jpg",
                "type": "Weapon",
                "attack": 14,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Avenging Mace",
                "image": null,
                "type": "Weapon",
                "attack": 16,
                "defense": 13,
                "hero": null,
                "recipe1": "Blood Zealot",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Battle Axe",
                "image": "eq_axe.jpg",
                "type": "Weapon",
                "attack": 4,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Battle Spear",
                "image": "spear_160_160.jpg",
                "type": "Weapon",
                "attack": 2,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Berserker Axe",
                "image": "demi_attack_weapon.jpg",
                "type": "Weapon",
                "attack": 20,
                "defense": 13,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Blade of Arielle",
                "image": null,
                "type": "Weapon",
                "attack": 9,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Attack to Arielle"
            },
            {
                "name": "Blade of Ursus",
                "image": null,
                "type": "Weapon",
                "attack": 20,
                "defense": 17,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Blade of Vengeance",
                "image": "demi_stamina_weapon.jpg",
                "type": "Weapon",
                "attack": 17,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Bladebourne Saber",
                "image": null,
                "type": "Weapon",
                "attack": 12,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Miri"
            },
            {
                "name": "Bloodblade",
                "image": "gift_vanquish2_complete.jpg",
                "type": "Weapon",
                "attack": 5,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Vanquish"
            },
            {
                "name": "Bonecrusher",
                "image": "eq_gehenna_sword_2.jpg",
                "type": "Weapon",
                "attack": 18,
                "defense": 21,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Sano"
            },
            {
                "name": "Bramble Blade",
                "image": "eq_earth_rare_sword.jpg",
                "type": "Weapon",
                "attack": 10,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Burning Blade",
                "image": "eq_volcanic_weapon3.jpg",
                "type": "Weapon",
                "attack": 16,
                "defense": 13,
                "hero": null,
                "recipe1": "Volcanic Knight",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Caldonian Blade",
                "image": null,
                "type": "Weapon",
                "attack": 13,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 attack to Garlan"
            },
            {
                "name": "Celestas Devotion",
                "image": null,
                "type": "Weapon",
                "attack": 22,
                "defense": 44,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3% Critical when Celesta is equipped"
            },
            {
                "name": "Chaos Staff",
                "image": null,
                "type": "Weapon",
                "attack": 18,
                "defense": 19,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Cid Saber",
                "image": null,
                "type": "Weapon",
                "attack": 6,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Cid"
            },
            {
                "name": "Cloudslayer Blade",
                "image": null,
                "type": "Weapon",
                "attack": 15,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Delfina"
            },
            {
                "name": "Colossal Axe",
                "image": null,
                "type": "Weapon",
                "attack": 6,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Colossal Sword",
                "image": null,
                "type": "Weapon",
                "attack": 3,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Crimson Dagger",
                "image": null,
                "type": "Weapon",
                "attack": 3,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 energy when Elena is equipped"
            },
            {
                "name": "Crusader Blade",
                "image": null,
                "type": "Weapon",
                "attack": 10,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Crusader Dagger",
                "image": null,
                "type": "Weapon",
                "attack": 6,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Crushing Blade",
                "image": null,
                "type": "Weapon",
                "attack": 6,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Darius"
            },
            {
                "name": "Crystal Rod",
                "image": null,
                "type": "Weapon",
                "attack": 9,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Crystalline Rod",
                "image": null,
                "type": "Weapon",
                "attack": 14,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Defense to Scarlett"
            },
            {
                "name": "Daedalus",
                "image": null,
                "type": "Weapon",
                "attack": 9,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dagger",
                "image": null,
                "type": "Weapon",
                "attack": 1,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dagger +1",
                "image": null,
                "type": "Weapon",
                "attack": 2,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Death Dealer",
                "image": null,
                "type": "Weapon",
                "attack": 18,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Kaiser"
            },
            {
                "name": "Deathbellow",
                "image": null,
                "type": "Weapon",
                "attack": 19,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Barbarus"
            },
            {
                "name": "Deathrune Blade",
                "image": null,
                "type": "Weapon",
                "attack": 11,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Deliverance",
                "image": null,
                "type": "Weapon",
                "attack": 16,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Demon Blade",
                "image": null,
                "type": "Weapon",
                "attack": 9,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Demonic Sword",
                "image": null,
                "type": "Weapon",
                "attack": 8,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Divinity Mace",
                "image": null,
                "type": "Weapon",
                "attack": 10,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Gallador"
            },
            {
                "name": "Draganblade",
                "image": null,
                "type": "Weapon",
                "attack": 7,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Attack when Dragan is equipped"
            },
            {
                "name": "Dragon Talon",
                "image": null,
                "type": "Weapon",
                "attack": 6,
                "defense": 6,
                "hero": null,
                "recipe1": "Helm of Dragon Power",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Dragonbane",
                "image": null,
                "type": "Weapon",
                "attack": 5,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Drakken Blade",
                "image": null,
                "type": "Weapon",
                "attack": 12,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Attack to Draconius"
            },
            {
                "name": "Dreadnought Greatsword",
                "image": null,
                "type": "Weapon",
                "attack": 7,
                "defense": 4,
                "hero": "Keira",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Elven Staff",
                "image": null,
                "type": "Weapon",
                "attack": 7,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Emerald Saber",
                "image": null,
                "type": "Weapon",
                "attack": 9,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 attack to Aria"
            },
            {
                "name": "Emperion Sword",
                "image": null,
                "type": "Weapon",
                "attack": 16,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Gawain"
            },
            {
                "name": "Excalibur",
                "image": null,
                "type": "Weapon",
                "attack": 25,
                "defense": 12,
                "hero": null,
                "recipe1": "Soulforge",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Exsanguinator",
                "image": null,
                "type": "Weapon",
                "attack": 32,
                "defense": 22,
                "hero": "Vincent",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Festivus Sword",
                "image": "eq_festival_battle_weapon.jpg",
                "type": "Weapon",
                "attack": 33,
                "defense": 33,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Gives +9 Health when Deianira is equipped.  Obtained by going to the bottom of the Guild Shop and recruiting 25 friends to click on your gift link.  Available as part of the Festival celebration."
            },
            {
                "name": "Fiery Blade",
                "image": "gift_dante_complete.jpg",
                "type": "Weapon",
                "attack": 6,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Dante"
            },
            {
                "name": "Flame Bow",
                "image": null,
                "type": "Weapon",
                "attack": 3,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Frost Edge",
                "image": null,
                "type": "Weapon",
                "attack": 17,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 attack to Lilith & Riku"
            },
            {
                "name": "Frostfire Staves",
                "image": null,
                "type": "Weapon",
                "attack": 10,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Frostwolf Axe",
                "image": "gift_shino_complete.jpg",
                "type": "Weapon",
                "attack": 10,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Components collected from Mystery Axe Gifts, +1 attack when Shino is equipped"
            },
            {
                "name": "Fury Maul Axe",
                "image": "eq_barbarian_axe.jpg",
                "type": "Weapon",
                "attack": 11,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Common drop from Vanguard Chest."
            },
            {
                "name": "Genesis Sword",
                "image": null,
                "type": "Weapon",
                "attack": 20,
                "defense": 30,
                "hero": "Medius",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 attack to Medius"
            },
            {
                "name": "Gildamesh's War Axe",
                "image": null,
                "type": "Weapon",
                "attack": 6,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gilded Bow",
                "image": null,
                "type": "Weapon",
                "attack": 10,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Glacial Blade",
                "image": null,
                "type": "Weapon",
                "attack": 6,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Gladiator Sword",
                "image": null,
                "type": "Weapon",
                "attack": 5,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Golden Horn Bow",
                "image": null,
                "type": "Weapon",
                "attack": 17,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Elora"
            },
            {
                "name": "Gorlak's Axe",
                "image": null,
                "type": "Weapon",
                "attack": 11,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 attack to Dexter"
            },
            {
                "name": "Gorlak's Cudgel",
                "image": null,
                "type": "Weapon",
                "attack": 10,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 attack to Gorlak"
            },
            {
                "name": "Great Halberd",
                "image": null,
                "type": "Weapon",
                "attack": 8,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Halcyon Grinder",
                "image": null,
                "type": "Weapon",
                "attack": 12,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Halycon"
            },
            {
                "name": "Heart of the Woods",
                "image": null,
                "type": "Weapon",
                "attack": 30,
                "defense": 44,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Divine Power 120.  The ingredients can be obtained by defeating Aurora.  Currently the Best Overall Weapon in the game"
            },
            {
                "name": "Hellblade",
                "image": null,
                "type": "Weapon",
                "attack": 30,
                "defense": 20,
                "hero": null,
                "recipe1": "Soulforge",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Sometimes dropped after slaying Alpha Mephistopheles, +5 Attack to Chimerus"
            },
            {
                "name": "Hellkite Sword",
                "image": null,
                "type": "Weapon",
                "attack": 5,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Hephaestus Sword",
                "image": null,
                "type": "Weapon",
                "attack": 28,
                "defense": 22,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Holy Avenger",
                "image": null,
                "type": "Weapon",
                "attack": 12,
                "defense": 12,
                "hero": null,
                "recipe1": "Excalibur",
                "recipe1image": null,
                "recipe2": "Soulforge",
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Piece is used to create Excalibur which in turn creates Soulforge"
            },
            {
                "name": "Icicle Lance",
                "image": null,
                "type": "Weapon",
                "attack": 12,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Incarnation",
                "image": null,
                "type": "Weapon",
                "attack": 11,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 attack to Lailah"
            },
            {
                "name": "Infernal Sword",
                "image": null,
                "type": "Weapon",
                "attack": 16,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Inoculator",
                "image": null,
                "type": "Weapon",
                "attack": 20,
                "defense": 17,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Iron Axe",
                "image": null,
                "type": "Weapon",
                "attack": 3,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ironhart's Might",
                "image": null,
                "type": "Weapon",
                "attack": 5,
                "defense": 1,
                "hero": null,
                "recipe1": "Judgement",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Jadan Wand",
                "image": null,
                "type": "Weapon",
                "attack": 10,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Jada"
            },
            {
                "name": "Judgement",
                "image": null,
                "type": "Weapon",
                "attack": 10,
                "defense": 5,
                "hero": null,
                "recipe1": "Holy Plate",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Justice",
                "image": null,
                "type": "Weapon",
                "attack": 10,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Kingblade",
                "image": null,
                "type": "Weapon",
                "attack": 31,
                "defense": 24,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lance of Valhalla",
                "image": null,
                "type": "Weapon",
                "attack": 15,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lavareign Axe",
                "image": null,
                "type": "Weapon",
                "attack": 12,
                "defense": 17,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lifebane",
                "image": null,
                "type": "Weapon",
                "attack": 14,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 attack to Adriana"
            },
            {
                "name": "Lightbringer",
                "image": null,
                "type": "Weapon",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lightguard Rapier",
                "image": null,
                "type": "Weapon",
                "attack": 17,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lion Fang",
                "image": null,
                "type": "Weapon",
                "attack": 24,
                "defense": 22,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Lionheart Blade",
                "image": null,
                "type": "Weapon",
                "attack": 8,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Long Sword",
                "image": null,
                "type": "Weapon",
                "attack": 3,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Longsword +1",
                "image": null,
                "type": "Weapon",
                "attack": 4,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Meat Cleaver",
                "image": null,
                "type": "Weapon",
                "attack": 44,
                "defense": 22,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Moonclaw",
                "image": null,
                "type": "Weapon",
                "attack": 12,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+0.5% Critical when Fenris is equipped"
            },
            {
                "name": "Moonfall Mace",
                "image": null,
                "type": "Weapon",
                "attack": 8,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Morningstar",
                "image": null,
                "type": "Weapon",
                "attack": 3,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Mystical Dagger",
                "image": null,
                "type": "Weapon",
                "attack": 5,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Attack when Edea is equipped"
            },
            {
                "name": "Nautical Trident",
                "image": "gift_nautica_complete.jpg",
                "type": "Weapon",
                "attack": 9,
                "defense": 5,
                "hero": "Nautica",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": " +2 Attack to Nautica"
            },
            {
                "name": "Oathkeeper",
                "image": null,
                "type": "Weapon",
                "attack": 7,
                "defense": 4,
                "hero": "Leon Ironhart",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Oberon's Might",
                "image": null,
                "type": "Weapon",
                "attack": 20,
                "defense": 17,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Obsidian Sword",
                "image": null,
                "type": "Weapon",
                "attack": 11,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Onslaught",
                "image": null,
                "type": "Weapon",
                "attack": 15,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Orc War Axe",
                "image": null,
                "type": "Weapon",
                "attack": 4,
                "defense": 1,
                "hero": null,
                "recipe1": "Avenger",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ornate Axe",
                "image": null,
                "type": "Weapon",
                "attack": 7,
                "defense": 7,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Ornate Dagger",
                "image": null,
                "type": "Weapon",
                "attack": 16,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Kaiser"
            },
            {
                "name": "Path of the Tower",
                "image": null,
                "type": "Weapon",
                "attack": 22,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Prismatic Staff",
                "image": null,
                "type": "Weapon",
                "attack": 17,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Azalia"
            },
            {
                "name": "Prophetic Wand",
                "image": null,
                "type": "Weapon",
                "attack": 17,
                "defense": 21,
                "hero": "Shivak",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Punisher",
                "image": null,
                "type": "Weapon",
                "attack": 14,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rift Blade",
                "image": null,
                "type": "Weapon",
                "attack": 15,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Godric"
            },
            {
                "name": "Righteousness",
                "image": null,
                "type": "Weapon",
                "attack": 14,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 attack to Minerva"
            },
            {
                "name": "Rockcrusher Axe",
                "image": null,
                "type": "Weapon",
                "attack": 14,
                "defense": 10,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rocklasher",
                "image": "eq_shardros_weapon1.jpg",
                "type": "Weapon",
                "attack": null,
                "defense": null,
                "hero": null,
                "recipe1": "Stonebreaker",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rockthorn Bow",
                "image": null,
                "type": "Weapon",
                "attack": 12,
                "defense": 11,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rune Axe",
                "image": null,
                "type": "Weapon",
                "attack": 8,
                "defense": 6,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Rune Blade",
                "image": null,
                "type": "Weapon",
                "attack": 10,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 attack to Lyra"
            },
            {
                "name": "Scepter of Light",
                "image": null,
                "type": "Weapon",
                "attack": 2,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Defense when Penelope is equipped"
            },
            {
                "name": "Scytheblade",
                "image": null,
                "type": "Weapon",
                "attack": 18,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Crissana"
            },
            {
                "name": "Serenity Blade",
                "image": null,
                "type": "Weapon",
                "attack": 16,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Zin"
            },
            {
                "name": "Shadow Blades",
                "image": null,
                "type": "Weapon",
                "attack": 11,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shadowfel Katara",
                "image": null,
                "type": "Weapon",
                "attack": 18,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shining Greatsword",
                "image": null,
                "type": "Weapon",
                "attack": 10,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Short Sword",
                "image": null,
                "type": "Weapon",
                "attack": 2,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Shortsword +1",
                "image": null,
                "type": "Weapon",
                "attack": 3,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Silver Mace",
                "image": null,
                "type": "Weapon",
                "attack": 2,
                "defense": 4,
                "hero": null,
                "recipe1": "Morningstar",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Silverfist Hammer",
                "image": null,
                "type": "Weapon",
                "attack": 19,
                "defense": 15,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Skullcrush Mace",
                "image": null,
                "type": "Weapon",
                "attack": 5,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 attack to Karn"
            },
            {
                "name": "Solstice Blade",
                "image": null,
                "type": "Weapon",
                "attack": 15,
                "defense": 17,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Solara"
            },
            {
                "name": "Soul Siphon",
                "image": null,
                "type": "Weapon",
                "attack": 10,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Soulforge",
                "image": null,
                "type": "Weapon",
                "attack": 35,
                "defense": 35,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% Crit when Strider, Dragan, Sophia or Penelope is equipped"
            },
            {
                "name": "Spartan Spear",
                "image": null,
                "type": "Weapon",
                "attack": 2,
                "defense": 0,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Staff of Jahanna",
                "image": null,
                "type": "Weapon",
                "attack": 26,
                "defense": 30,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Staff of the Lifeless",
                "image": "eq_aurora_staff.jpg",
                "type": "Weapon",
                "attack": 25,
                "defense": 20,
                "hero": null,
                "recipe1": "Heart of the Woods",
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Sometimes dropped by Aurora. Used to create Heart of the Woods."
            },
            {
                "name": "Staff of the Martyr",
                "image": null,
                "type": "Weapon",
                "attack": 15,
                "defense": 19,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Staff of the Tempest",
                "image": null,
                "type": "Weapon",
                "attack": 4,
                "defense": 2,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Staff of Vigor",
                "image": "gift_elizabeth3_complete.jpg",
                "type": "Weapon",
                "attack": 8,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+4 Stamina to Elizabeth Lione"
            },
            {
                "name": "Stormcrusher",
                "image": null,
                "type": "Weapon",
                "attack": 35,
                "defense": 20,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Stormwind Saber",
                "image": null,
                "type": "Weapon",
                "attack": 11,
                "defense": 16,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 Attack to Kaylen"
            },
            {
                "name": "Sun Blade",
                "image": null,
                "type": "Weapon",
                "attack": 10,
                "defense": 5,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Sword of Light",
                "image": null,
                "type": "Weapon",
                "attack": 2,
                "defense": 1,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Sword of Might",
                "image": null,
                "type": "Weapon",
                "attack": 3,
                "defense": 1,
                "hero": "Elin",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Elin"
            },
            {
                "name": "Sword of the Faithless",
                "image": null,
                "type": "Weapon",
                "attack": 7,
                "defense": 7,
                "hero": "Cartigan",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Sword of the Sea",
                "image": null,
                "type": "Weapon",
                "attack": 5,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Syrens Call",
                "image": null,
                "type": "Weapon",
                "attack": 20,
                "defense": 18,
                "hero": "Syren",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Terra's Blade",
                "image": "gift_terra_complete.jpg",
                "type": "Weapon",
                "attack": 10,
                "defense": 9,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Gives +3 Attack to Terra"
            },
            {
                "name": "The Disembowler",
                "image": null,
                "type": "Weapon",
                "attack": 17,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 attack to Kataan"
            },
            {
                "name": "The Galvanizer",
                "image": null,
                "type": "Weapon",
                "attack": 27,
                "defense": 23,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "The Reckoning",
                "image": null,
                "type": "Weapon",
                "attack": 40,
                "defense": 28,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Titania Bow",
                "image": null,
                "type": "Weapon",
                "attack": 6,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+3 Attack to Titania"
            },
            {
                "name": "Trident of the Deep",
                "image": null,
                "type": "Weapon",
                "attack": 6,
                "defense": 3,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Truthseeker Blade",
                "image": null,
                "type": "Weapon",
                "attack": 15,
                "defense": 22,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Vampiric Blade",
                "image": null,
                "type": "Weapon",
                "attack": 10,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 attack to Slayer"
            },
            {
                "name": "Virtue of Justice",
                "image": null,
                "type": "Weapon",
                "attack": 25,
                "defense": 25,
                "hero": "Hyperion",
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1 Attack to Hyperion"
            },
            {
                "name": "Wand of Illusia",
                "image": null,
                "type": "Weapon",
                "attack": 9,
                "defense": 8,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Warriors Blade",
                "image": null,
                "type": "Weapon",
                "attack": 30,
                "defense": 19,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Arena Season 3, Tier 3 reward"
            },
            {
                "name": "Whisper Bow",
                "image": null,
                "type": "Weapon",
                "attack": 6,
                "defense": 4,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Wildleaf Bow",
                "image": null,
                "type": "Weapon",
                "attack": 18,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Wildwalker Staff",
                "image": null,
                "type": "Weapon",
                "attack": 11,
                "defense": 12,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+1% critical when Anwar is equipped"
            },
            {
                "name": "Windthorn Wand",
                "image": null,
                "type": "Weapon",
                "attack": 16,
                "defense": 14,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "+2 attack to Suri"
            },
            {
                "name": "Zarevok's Meat Cleaver",
                "image": null,
                "type": "Weapon",
                "attack": 44,
                "defense": 22,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": "Arena Season 1, Tier 5 reward. +3 attack, +3 defense to Zarevok when equipped."
            },
            {
                "name": "Zenarean Bow",
                "image": null,
                "type": "Weapon",
                "attack": 14,
                "defense": 18,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            },
            {
                "name": "Zenarean Dagger",
                "image": null,
                "type": "Weapon",
                "attack": 20,
                "defense": 19,
                "hero": null,
                "recipe1": null,
                "recipe1image": null,
                "recipe2": null,
                "recipe2image": null,
                "recipe3": null,
                "recipe3image": null,
                "recipe4": null,
                "recipe4image": null,
                "recipe5": null,
                "recipe5image": null,
                "summon": null,
                "comment": null
            }
        ]
    };

    ////////////////////////////////////////////////////////////////////
    //                          config OBJECT
    // this is the main object for dealing with user options
    /////////////////////////////////////////////////////////////////////

    config = {
        options: {},

        load: function () {
            try {
                config.options = gm.getItem('config.options', 'default');
                if (config.options === 'default' || !$j.isPlainObject(config.options)) {
                    config.options = gm.setItem('config.options', {});
                }

                $u.log(5, "config.load", config.options);
                return true;
            } catch (err) {
                $u.error("ERROR in config.load: " + err);
                return false;
            }
        },

        save: function (force) {
            try {
                gm.setItem('config.options', config.options);
                $u.log(5, "config.save", config.options);
                return true;
            } catch (err) {
                $u.error("ERROR in config.save: " + err);
                return false;
            }
        },

        setItem: function (name, value) {
            try {
                if (!$u.isString(name) || name === '') {
                    throw "Invalid identifying name!";
                }

                if (!$u.isDefined(value)) {
                    throw "Value supplied is 'undefined' or 'null'!";
                }

                config.options[name] = value;
                config.save();
                return value;
            } catch (err) {
                $u.error("ERROR in config.setItem: " + err);
                return undefined;
            }
        },

        getItem: function (name, value) {
            try {
                var item;
                if (!$u.isString(name) || name === '') {
                    throw "Invalid identifying name!";
                }

                item = config.options[name];
                if (!$u.isDefined(item) && $u.isDefined(value)) {
                    item = value;
                }

                if (!$u.isDefined(item)) {
                    $u.warn("config.getItem returned 'undefined' or 'null' for", name);
                }

                return item;
            } catch (err) {
                $u.error("ERROR in config.getItem: " + err);
                return undefined;
            }
        },

        getList: function (name, value) {
            try {
                var item = [];
                if (!$u.isString(name) || name === '') {
                    throw "Invalid identifying name!";
                }

                item = config.getItem(name, value).toArray();
                return item;
            } catch (err) {
                $u.error("ERROR in config.getArray: " + err);
                return undefined;
            }
        },

        deleteItem: function (name) {
            try {
                if (!$u.isString(name) || name === '') {
                    throw "Invalid identifying name!";
                }

                if (!$u.isDefined(config.options[name])) {
                    $u.warn("config.deleteItem - Invalid or non-existant name:", name);
                } else {
                    delete config.options[name];
                    config.save();
                }

                return true;
            } catch (err) {
                $u.error("ERROR in config.deleteItem: " + err);
                return false;
            }
        }
    };

    ////////////////////////////////////////////////////////////////////
    //                          state OBJECT
    // this is the main object for dealing with state flags
    /////////////////////////////////////////////////////////////////////

    state = {
        flags: {},

        load: function () {
            try {
                state.flags = gm.getItem('state.flags', 'default');
                if (state.flags === 'default' || !$j.isPlainObject(state.flags)) {
                    state.flags = gm.setItem('state.flags', {});
                }

                $u.log(5, "state.load", state.flags);
                return true;
            } catch (err) {
                $u.error("ERROR in state.load: " + err);
                return false;
            }
        },

        save: function (force) {
            try {
                if (!force) {
                    if (!schedule.check('StateSave')) {
                        return false;
                    }
                }

                gm.setItem('state.flags', state.flags);
                $u.log(5, "state.save", state.flags);
                schedule.setItem('StateSave', 1);
                return true;
            } catch (err) {
                $u.error("ERROR in state.save: " + err);
                return false;
            }
        },

        setItem: function (name, value) {
            try {
                if (!$u.isString(name) || name === '') {
                    throw "Invalid identifying name!";
                }

                if (!$u.isDefined(value)) {
                    throw "Value supplied is 'undefined' or 'null'!";
                }

                state.flags[name] = value;
                state.save();
                return value;
            } catch (err) {
                $u.error("ERROR in state.setItem: " + err);
                return undefined;
            }
        },

        getItem: function (name, value) {
            try {
                var item;
                if (!$u.isString(name) || name === '') {
                    throw "Invalid identifying name!";
                }

                item = state.flags[name];
                if (!$u.isDefined(item) && $u.isDefined(value)) {
                    item = value;
                }

                if (!$u.isDefined(item)) {
                    $u.warn("state.getItem returned 'undefined' or 'null' for", name);
                }

                return item;
            } catch (err) {
                $u.error("ERROR in state.getItem: " + err);
                return undefined;
            }
        },

        deleteItem: function (name) {
            try {
                if (!$u.isString(name) || name === '') {
                    throw "Invalid identifying name!";
                }

                if (!$u.isDefined(state.flags[name])) {
                    $u.warn("state.deleteItem - Invalid or non-existant flag: ", name);
                }

                delete state.flags[name];
                return true;
            } catch (err) {
                $u.error("ERROR in state.deleteItem: " + err);
                return false;
            }
        }
    };

    ////////////////////////////////////////////////////////////////////
    //                          css OBJECT
    // this is the object for inline css
    /////////////////////////////////////////////////////////////////////

    css = {
        addCSS: function () {
            try {
                if (!$u.hasContent($j('link[href*="jquery-ui.css"]'))) {
                    $j("<link>").appendTo("head").attr({
                        rel  : "stylesheet",
                        type : "text/css",
                        href : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/smoothness/jquery-ui.css"
                    });
                }

                $j("<style type='text/css'>" + css.farbtastic + "</style>").appendTo("head");
                $j("<style type='text/css'>" + css.caap + "</style>").appendTo("head");
                return true;
            } catch (err) {
                $u.error("ERROR in addCSS: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        caap: "#caap_div, #caap_top, #caap_topmin, #caap_playbuttondiv {-moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px;}" +
              "#caap_top {text-align: left;}" +
              "#caap_div, #caap_top, .caap_ff, .ui-dialog-title {font-family: 'Lucida Grande', tahoma, verdana, arial, sans-serif;}" +
              ".caap_fs {font-size: 10px;}" +
              "#caap_div, #caap_top, .caap_fn, .ui-dialog-title, .ui-button-text, .ui-state-highlight {font-size: 11px;}" +
              ".ui-state-highlight {line-height: 10px;}" +
              ".caap_ww {width: 100%;}" +
              ".caap_in {padding-left: 5%;}" +
              ".caap_ul {list-style-type: none; padding: 0px; margin: 0px; height: 11px; line-height: 10px;}" +
              ".caap_tr {text-align: right;}" +
              ".caap_table {width: 100%; border-collapse: collapse; border-spacing: 0px; font-size: 10px; text-align: left;}" +
              ".sorting_asc {background: url(data:image/gif;base64," + image64['asc'] + ") no-repeat center right;}" +
              ".sorting_desc {background: url(data:image/gif;base64," + image64['desc'] + ") no-repeat center right;}" +
              ".sorting {background: url(data:image/gif;base64," + image64['bg'] + ") no-repeat center right;}" +
              ".sorting, .sorting_asc, .sorting_desc {font-size: 10px; font-weight: bold; text-align: left; cursor: pointer; * cursor: hand;}" +
              ".caap_table td, .odd, .even, .odd td, .even td {font-size: 10px; text-align: left;}",

        farbtastic: ".farbtastic {position: relative;}" +
                    ".farbtastic * {position: absolute; cursor: crosshair;}" +
                    ".farbtastic, .farbtastic .wheel {width: 195px; height: 195px;}" +
                    ".farbtastic .color, .farbtastic .overlay {top: 47px; left: 47px; width: 101px; height: 101px;}" +
                    ".farbtastic .wheel {background: url(data:image/png;base64," + image64['wheel'] + ") no-repeat; width: 195px; height: 195px;}" +
                    ".farbtastic .overlay {background: url(data:image/png;base64," + image64['mask'] + ") no-repeat;}" +
                    ".farbtastic .marker {width: 17px; height: 17px; margin: -8px 0 0 -8px; overflow: hidden; background: url(data:image/png;base64," + image64['marker'] + ") no-repeat;}"
        /*jslint sub: false */
    };

    ////////////////////////////////////////////////////////////////////
    //                          sort OBJECT
    // this is the main object for dealing with sort routines
    /////////////////////////////////////////////////////////////////////

    sort = {
        order: function () {
            this.data = {
                'reverse': {
                    'a': false,
                    'b': false,
                    'c': false
                },
                'value': {
                    'a': '',
                    'b': '',
                    'c': ''
                }
            };
        },

        dialog: {},

        form: function (id, list, records) {
            try {
                var html = '',
                    it   = 0,
                    it1  = 0,
                    len1 = 0;

                if (!$u.hasContent(sort.dialog[id])) {
                    list.unshift("");
                    html += "<p>Sort by ...</p>";
                    for (it = 0; it < 3; it += 1) {
                        html += "<div style='padding-bottom: 30px;'>";
                        html += "<div style='float: left; padding-right: 30px;'>";
                        html += "<form id='form" + it + "'>";
                        html += "<input type='radio' id='asc" + it + "' name='reverse' value='false' checked /> Ascending<br />";
                        html += "<input type='radio' id='des" + it + "' name='reverse' value='true' /> Descending";
                        html += "</form>";
                        html += "</div>";
                        html += "<div>";
                        html += "<select id='select" + it + "'>";
                        for (it1 = 0, len1 = list.length; it1 < len1; it1 += 1) {
                            html += "<option value='" + list[it1] + "'>" + list[it1] + "</option>";
                        }

                        html += "</select>";
                        html += "</div>";
                        html += "</div>";
                        if (it < 2) {
                            html += "<p>Then by ...</p>";
                        }
                    }

                    sort.dialog[id] = $j('<div id="sort_form_' + id + '" title="Sort ' + id + '">' + html + '</div>').appendTo(window.document.body);
                    sort.dialog[id].dialog({
                        buttons: {
                            "Sort": function () {
                                sort.getForm(id, records);
                                $j(this).dialog("close");
                            },
                            "Cancel": function () {
                                $j(this).dialog("close");
                            }
                        }
                    });
                } else {
                    sort.dialog[id].dialog("open");
                }

                sort.updateForm(id);
                return true;
            } catch (err) {
                $u.error("ERROR in sort.form: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        getForm: function (id, records) {
            try {
                var order = new sort.order();
                if ($u.hasContent(sort.dialog[id])) {
                    order.data['reverse']['a'] = $j("#form0 input[name='reverse']:checked", sort.dialog[id]).val() === "true" ? true : false;
                    order.data['reverse']['b'] = $j("#form1 input[name='reverse']:checked", sort.dialog[id]).val() === "true" ? true : false;
                    order.data['reverse']['c'] = $j("#form2 input[name='reverse']:checked", sort.dialog[id]).val() === "true" ? true : false;
                    order.data['value']['a'] = $j("#select0 option:selected", sort.dialog[id]).val();
                    order.data['value']['b'] = $j("#select1 option:selected", sort.dialog[id]).val();
                    order.data['value']['c'] = $j("#select2 option:selected", sort.dialog[id]).val();
                    records.sort($u.sortBy(order.data['reverse']['a'], order.data['value']['a'], $u.sortBy(order.data['reverse']['b'], order.data['value']['b'], $u.sortBy(order.data['reverse']['c'], order.data['value']['c']))));
                    state.setItem(id + "Sort", order);
                    state.setItem(id + "DashUpdate", true);
                    caap.updateDashboard(true);
                } else {
                    $u.log(3, "Dialog for getForm not found", id);
                }

                return order.data;
            } catch (err) {
                $u.error("ERROR in sort.getForm: " + err);
                return undefined;
            }
        },

        updateForm: function (id) {
            try {
                var order = new sort.order();
                if ($u.hasContent(sort.dialog[id])) {
                    $j.extend(true, order.data, state.getItem(id + "Sort", order));
                    $j("#form0 input", sort.dialog[id]).val([order.data['reverse']['a']]);
                    $j("#form1 input", sort.dialog[id]).val([order.data['reverse']['b']]);
                    $j("#form2 input", sort.dialog[id]).val([order.data['reverse']['c']]);
                    $j("#select0", sort.dialog[id]).val(order.data['value']['a']);
                    $j("#select1", sort.dialog[id]).val(order.data['value']['b']);
                    $j("#select2", sort.dialog[id]).val(order.data['value']['c']);
                } else {
                    $u.log(3, "Dialog for updateForm not found", id);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in sort.updateForm: " + err);
                return false;
            }
        }
        /*jslint sub: false */
    };

    ////////////////////////////////////////////////////////////////////
    //                          schedule OBJECT
    // this is the main object for dealing with scheduling and timers
    /////////////////////////////////////////////////////////////////////

    schedule = {
        timers: {},

        load: function () {
            try {
                schedule.timers = gm.getItem('schedule.timers', 'default');
                if (schedule.timers === 'default' || !$j.isPlainObject(schedule.timers)) {
                    schedule.timers = gm.setItem('schedule.timers', {});
                }

                $u.log(5, "schedule.load", schedule.timers);
                return true;
            } catch (err) {
                $u.error("ERROR in schedule.load: " + err);
                return false;
            }
        },

        save: function (force) {
            try {
                gm.setItem('schedule.timers', schedule.timers);
                $u.log(5, "schedule.save", schedule.timers);
                return true;
            } catch (err) {
                $u.error("ERROR in schedule.save: " + err);
                return false;
            }
        },

        setItem: function (name, seconds, randomSecs) {
            try {
                var now = 0;
                if (!$u.isString(name) || name === '') {
                    throw "Invalid identifying name! (" + name + ")";
                }

                if (!$u.isNumber(seconds) || seconds < 0) {
                    throw "Invalid number of seconds supplied for (" + name + ") (" + seconds + ")";
                }

                if (!$u.isNumber(randomSecs) || randomSecs < 0) {
                    randomSecs = 0;
                }

                now = new Date().getTime();
                schedule.timers[name] = {
                    'last': now,
                    'next': now + (seconds * 1000) + (Math.floor(Math.random() * randomSecs) * 1000)
                };

                schedule.save();
                return schedule.timers[name];
            } catch (err) {
                $u.error("ERROR in schedule.setItem: " + err);
                return undefined;
            }
        },

        getItem: function (name) {
            try {
                if (!$u.isString(name) || name === '') {
                    throw "Invalid identifying name! (" + name + ")";
                }

                if (!$j.isPlainObject(schedule.timers[name])) {
                    $u.warn("Invalid or non-existant timer!", name);
                    return 0;
                }

                return schedule.timers[name];
            } catch (err) {
                $u.error("ERROR in schedule.getItem: " + err);
                return undefined;
            }
        },

        deleteItem: function (name) {
            try {
                if (!$u.isString(name) || name === '') {
                    throw "Invalid identifying name! (" + name + ")";
                }

                if (!$j.isPlainObject(schedule.timers[name])) {
                    $u.warn("schedule.deleteItem - Invalid or non-existant timer: ", name);
                }

                delete schedule.timers[name];
                return true;
            } catch (err) {
                $u.error("ERROR in schedule.deleteItem: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        check: function (name) {
            try {
                var scheduled = false;
                if (!$u.isString(name) || name === '') {
                    throw "Invalid identifying name! (" + name + ")";
                }

                if (!$j.isPlainObject(schedule.timers[name])) {
                    if ($u.get_log_level > 2) {
                        $u.warn("Invalid or non-existant timer!", name);
                    }

                    scheduled = true;
                } else if (schedule.timers[name]['next'] < new Date().getTime()) {
                    scheduled = true;
                }

                return scheduled;
            } catch (err) {
                $u.error("ERROR in schedule.check: " + err);
                return false;
            }
        },

        since: function (name_or_number, seconds) {
            try {
                var value = 0;
                if ($u.isNaN(name_or_number)) {
                    if (!$u.isString(name_or_number) || name_or_number === '') {
                        throw "Invalid identifying name! (" + name_or_number + ")";
                    }

                    if (!$j.isPlainObject(schedule.timers[name_or_number])) {
                        if ($u.get_log_level > 2) {
                            $u.warn("Invalid or non-existant timer!", name_or_number);
                        }
                    } else {
                        value = schedule.timers[name_or_number]['last'];
                    }
                } else {
                    value = name_or_number;
                }

                return (value < (new Date().getTime() - 1000 * seconds));
            } catch (err) {
                $u.error("ERROR in schedule.since: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        oneMinuteUpdate: function (funcName) {
            try {
                if (!state.getItem('reset' + funcName) && !schedule.check(funcName + 'Timer')) {
                    return false;
                }

                schedule.setItem(funcName + 'Timer', 60);
                state.setItem('reset' + funcName, false);
                return true;
            } catch (err) {
                $u.error("ERROR in schedule.oneMinuteUpdate: " + err);
                return undefined;
            }
        },

        str12: "D d M g:i A",

        str24: "D d M H:i",

        sStr12: "D g:i A",

        sStr24: "D H:i",

        timeStr: function (Short) {
            return config.getItem("use24hr", true) ? (Short ? schedule.sStr24 : schedule.str24) : (Short ? schedule.sStr12 : schedule.str12);
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        display: function (name) {
            try {
                var formatted = '';
                if (!$u.isString(name) || name === '') {
                    throw "Invalid identifying name!";
                }

                if (!$j.isPlainObject(schedule.timers[name])) {
                    if ($u.get_log_level > 2) {
                        $u.warn("Invalid or non-existant timer!", name);
                    }

                    formatted = $u.makeTime(new Date(), schedule.timeStr(true));
                } else {
                    formatted = $u.makeTime(schedule.timers[name]['next'], schedule.timeStr(true));
                }

                return formatted;
            } catch (err) {
                $u.error("ERROR in schedule.display: " + err);
                return false;
            }
        }
        /*jslint sub: false */
    };

    ////////////////////////////////////////////////////////////////////
    //                          general OBJECT
    // this is the main object for dealing with Generals
    /////////////////////////////////////////////////////////////////////

    general = {
        records: [],

        recordsSortable: [],

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        record: function () {
            this.data = {
                'name'       : '',
                'img'        : '',
                'lvl'        : 0,
                'pct'        : 0,
                'last'       : new Date().getTime() - (24 * 3600000),
                'special'    : '',
                'atk'        : 0,
                'def'        : 0,
                'api'        : 0,
                'dpi'        : 0,
                'mpi'        : 0,
                'eatk'       : 0,
                'edef'       : 0,
                'eapi'       : 0,
                'edpi'       : 0,
                'empi'       : 0,
                'energyMax'  : 0,
                'staminaMax' : 0,
                'healthMax'  : 0,
                'item'       : 0,
                'itype'      : 0,
                'coolDown'   : false,
                'charge'     : 0
            };
        },
        /*jslint sub: false */

        hbest: 0,

        load: function () {
            try {
                general.records = gm.getItem('general.records', 'default');
                if (general.records === 'default' || !$j.isArray(general.records)) {
                    general.records = gm.setItem('general.records', []);
                }

                general.BuildlLists();
                general.hbest = general.hbest === false ? JSON.hbest(general.records) : general.hbest;
                $u.log(3, "general.load Hbest", general.hbest);
                state.setItem("GeneralsDashUpdate", true);
                $u.log(3, "general.load", general.records);
                return true;
            } catch (err) {
                $u.error("ERROR in general.load: " + err);
                return false;
            }
        },

        save: function () {
            try {
                var compress = false;
                gm.setItem('general.records', general.records, general.hbest, compress);
                state.setItem("GeneralsDashUpdate", true);
                $u.log(3, "general.save", general.records);
                return true;
            } catch (err) {
                $u.error("ERROR in general.save: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        getItem: function (generalName, quiet) {
            try {
                if (!$u.hasContent(generalName) || !$u.isString(generalName)) {
                    $u.warn("generalName", generalName);
                    throw "Invalid identifying generalName!";
                }

                var it    = 0,
                    len   = 0,
                    found = false;

                for (it = 0, len = general.records.length; it < len; it += 1) {
                    if (general.records[it]['name'] === generalName) {
                        found = true;
                        break;
                    }
                }

                if (!found) {
                    if (!quiet) {
                        $u.warn("Unable to find 'General' record", generalName);
                    }

                    return false;
                }

                return general.records[it];
            } catch (err) {
                $u.error("ERROR in general.getItem: " + err);
                return false;
            }
        },

        setItem: function (record) {
            try {
                if (!record || !$j.isPlainObject(record)) {
                    throw "Not passed a record";
                }

                if (!$u.hasContent(record['name']) || !$u.isString(record['name'])) {
                    $u.warn("name", record['name']);
                    throw "Invalid identifying name!";
                }

                var it      = 0,
                    len     = 0,
                    success = false;

                for (it = 0, len = general.records.length; it < len; it += 1) {
                    if (general.records[it]['name'] === record['name']) {
                        success = true;
                        break;
                    }
                }

                if (success) {
                    general.records[it] = record;
                    $u.log(3, "Updated general record", record, general.records);
                } else {
                    general.records.push(record);
                    $u.log(3, "Added general record", record, general.records);
                }

                general.save();
                return true;
            } catch (err) {
                $u.error("ERROR in general.setItem: " + err);
                return false;
            }
        },

        GetNames: function () {
            try {
                var it    = 0,
                    len   = 0,
                    names = [];

                for (it = 0, len = general.records.length; it < len; it += 1) {
                    names.push(general.records[it]['name']);
                }

                return names.sort();
            } catch (err) {
                $u.error("ERROR in general.GetNames: " + err);
                return false;
            }
        },

        GetImage: function (generalName) {
            try {
                var genImg = general.getItem(generalName);

                if (genImg === false) {
                    $u.warn("Unable to find 'General' image");
                    genImg = '';
                } else {
                    genImg = genImg['img'];
                }

                return genImg;
            } catch (err) {
                $u.error("ERROR in general.GetImage: " + err);
                return false;
            }
        },

        GetStaminaMax: function (generalName) {
            try {
                var genStamina = general.getItem(generalName);

                if (genStamina === false) {
                    $u.warn("Unable to find 'General' stamina");
                    genStamina = 0;
                } else {
                    genStamina = genStamina['staminaMax'];
                }

                return genStamina;
            } catch (err) {
                $u.error("ERROR in general.GetStaminaMax: " + err);
                return false;
            }
        },

        GetEnergyMax: function (generalName) {
            try {
                var genEnergy = general.getItem(generalName);

                if (genEnergy === false) {
                    $u.warn("Unable to find 'General' energy");
                    genEnergy = 0;
                } else {
                    genEnergy = genEnergy['energyMax'];
                }

                return genEnergy;
            } catch (err) {
                $u.error("ERROR in general.GetEnergyMax: " + err);
                return false;
            }
        },

        GetHealthMax: function (generalName) {
            try {
                var genHealth = general.getItem(generalName);

                if (genHealth === false) {
                    $u.warn("Unable to find 'General' health");
                    genHealth = 0;
                } else {
                    genHealth = genHealth['healthMax'];
                }

                return genHealth;
            } catch (err) {
                $u.error("ERROR in general.GetHealthMax: " + err);
                return false;
            }
        },

        GetLevel: function (generalName) {
            try {
                var genLevel = general.getItem(generalName);

                if (genLevel === false) {
                    $u.warn("Unable to find 'General' level");
                    genLevel = 1;
                } else {
                    genLevel = genLevel['lvl'];
                }

                return genLevel;
            } catch (err) {
                $u.error("ERROR in general.GetLevel: " + err);
                return false;
            }
        },

        GetPercent: function (generalName) {
            try {
                var genPct = general.getItem(generalName);

                if (genPct === false) {
                    $u.warn("Unable to find 'General' level percent");
                    genPct = 0;
                } else {
                    genPct = genPct['pct'];
                }

                return genPct;
            } catch (err) {
                $u.error("ERROR in general.GetPercent: " + err);
                return false;
            }
        },

        GetLevelUpNames: function () {
            try {
                var it    = 0,
                    len   = 0,
                    names = [];

                for (it = 0, len = general.records.length; it < len; it += 1) {
                    if (general.records[it]['pct'] < 100) {
                        names.push(general.records[it]['name']);
                    }
                }

                return names;
            } catch (err) {
                $u.error("ERROR in general.GetLevelUpNames: " + err);
                return false;
            }
        },

        getCoolDownNames: function () {
            try {
                var it    = 0,
                    len   = 0,
                    names = [];

                for (it = 0, len = general.records.length; it < len; it += 1) {
                    if (general.records[it]['coolDown']) {
                        names.push(general.records[it]['name']);
                    }
                }

                return names.sort();
            } catch (err) {
                $u.error("ERROR in general.getCoolDownNames: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        List: [],

        BuyList: [],

        IncomeList: [],

        BankingList: [],

        CollectList: [],

        SubQuestList: [],

        coolDownList: [],

        StandardList: [
            'Idle',
            'Monster',
            'Fortify',
            'GuildMonster',
            'Invade',
            'Duel',
            'War'
            //'Arena'
            //'Festival'
        ],

        coolStandardList: [
            'Monster',
            'Fortify',
            'GuildMonster',
            'Invade',
            'Duel',
            'War'
        ],

        BuildlLists: function () {
            try {
                $u.log(3, 'Building Generals Lists');
                general.List = [
                    'Use Current',
                    'Under Level'
                ].concat(general.GetNames());

                var crossList = function (checkItem) {
                    return general.List.hasIndexOf(checkItem);
                };

                general.BuyList = [
                    'Use Current',
                    'Darius',
                    'Lucius',
                    'Garlan',
                    'Penelope'
                ].filter(crossList);

                general.IncomeList = [
                    'Use Current',
                    'Scarlett',
                    'Mercedes',
                    'Cid'
                ].filter(crossList);

                general.BankingList = [
                    'Use Current',
                    'Aeris'
                ].filter(crossList);

                general.CollectList = [
                    'Use Current',
                    'Angelica',
                    'Morrigan',
                    'Valiant'
                ].filter(crossList);

                general.SubQuestList = [
                    'Use Current',
                    'Under Level',
                    'Sano',
                    'Titania'
                ].filter(crossList);

                general.coolDownList = [
                    ''
                ].concat(general.getCoolDownNames());

                return true;
            } catch (err) {
                $u.error("ERROR in general.BuildlLists: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        GetCurrent: function () {
            try {
                var equipDiv    = $j("#" + caap.domain.id[caap.domain.which] + "equippedGeneralContainer", caap.globalContainer),
                    nameObj     = $j(".general_name_div3", equipDiv),
                    generalName = $u.setContent(nameObj.text(), '').trim().stripTRN().replace(/\*/g, ''),
                    record      = {};

                if (!generalName) {
                    $u.warn("Couldn't get current 'General'. Using 'Use Current'");
                    return 'Use Current';
                }

                record = general.getItem(generalName);
                if (record['coolDown'] && !$u.hasContent($j(".activeCooldownGeneralSmallContainer", equipDiv))) {
                    record['charge'] = 0;
                    general.setItem(record);
                }

                $u.log(4, "Current General", generalName);
                return generalName;
            } catch (err) {
                $u.error("ERROR in general.GetCurrent: " + err);
                return 'Use Current';
            }
        },

        GetGenerals: function () {
            try {
                var generalsDiv = $j(".generalSmallContainer2", caap.appBodyDiv),
                    update      = false,
                    save        = false;

                if ($u.hasContent(generalsDiv)) {
                    generalsDiv.each(function (index) {
                        var newGeneral = new general.record(),
                            name       = '',
                            img        = '',
                            item       = 0,
                            itype      = 0,
                            level      = 0,
                            percent    = 0,
                            atk        = 0,
                            def        = 0,
                            special    = '',
                            coolDown   = false,
                            charge     = 0,
                            container  = $j(this),
                            it         = 0,
                            len        = 0,
                            tempObj    = $j(".general_name_div3", container);

                        if ($u.hasContent(tempObj)) {
                            name = $u.setContent(tempObj.text(), '').stripTRN().replace(/\*/g, '');
                        } else {
                            $u.warn("Unable to find 'name' container", index);
                        }

                        tempObj = $j(".imgButton", container);
                        if ($u.hasContent(tempObj)) {
                            img = $u.setContent(tempObj.attr("src"), '').basename();
                        } else {
                            $u.warn("Unable to find 'image' container", index);
                        }

                        tempObj = $j("input[name='item']", container);
                        if ($u.hasContent(tempObj)) {
                            item = $u.setContent(tempObj.attr("value"), '').parseInt();
                        } else {
                            $u.warn("Unable to find 'item' container", index);
                        }

                        tempObj = $j("input[name='itype']", container);
                        if ($u.hasContent(tempObj)) {
                            itype = $u.setContent(tempObj.attr("value"), '').parseInt();
                        } else {
                            $u.warn("Unable to find 'itype' container", index);
                        }

                        tempObj = $j("div[style*='train_progress.jpg']", container);
                        if ($u.hasContent(tempObj)) {
                            coolDown = true;
                            charge = $u.setContent(tempObj.getPercent("width"), 0);
                        } else {
                            $u.log(4, "Not a cool down general", index);
                        }

                        tempObj = container.children().eq(3);
                        if ($u.hasContent(tempObj)) {
                            level = $u.setContent(tempObj.text(), '0').replace(/Level /gi, '').stripTRN().parseInt();
                        } else {
                            $u.warn("Unable to find 'level' container", index);
                        }

                        tempObj = $j("div[style*='#3b5561'],div[style*='rgb(59, 85, 97)']", container);
                        if ($u.hasContent(tempObj)) {
                            percent = tempObj.getPercent('width');
                        } else {
                            $u.warn("Unable to find 'level percent' container", index);
                        }

                        tempObj = container.children().eq(4);
                        if ($u.hasContent(tempObj)) {
                            special = $u.setContent($j($u.setContent(tempObj.html(), '').replace(/<br>/g, ' ')).text(), '').trim().innerTrim();
                        } else {
                            $u.warn("Unable to find 'special' container", index);
                        }

                        tempObj = $j(".generals_indv_stats_padding div", container);
                        if ($u.hasContent(tempObj) && tempObj.length === 2) {
                            atk = $u.setContent(tempObj.eq(0).text(), '0').parseInt();
                            def = $u.setContent(tempObj.eq(1).text(), '0').parseInt();
                        } else {
                            $u.warn("Unable to find 'attack and defence' containers", index);
                        }

                        if ($u.hasContent(name) && $u.hasContent(img) && $u.hasContent(level) && $u.hasContent(percent) && !$u.isNaN(atk) && !$u.isNaN(def) && $u.hasContent(special)) {
                            for (it = 0, len = general.records.length; it < len; it += 1) {
                                if (general.records[it]['name'] === name) {
                                    newGeneral.data = general.records[it];
                                    break;
                                }
                            }

                            newGeneral.data['name'] = name;
                            newGeneral.data['img'] = img;
                            newGeneral.data['item'] = item;
                            newGeneral.data['itype'] = itype;
                            newGeneral.data['coolDown'] = coolDown;
                            newGeneral.data['charge'] = charge;
                            newGeneral.data['lvl'] = level;
                            newGeneral.data['pct'] = percent;
                            newGeneral.data['atk'] = atk;
                            newGeneral.data['def'] = def;
                            newGeneral.data['api'] = (atk + (def * 0.7)).dp(2);
                            newGeneral.data['dpi'] = (def + (atk * 0.7)).dp(2);
                            newGeneral.data['mpi'] = ((newGeneral.data['api'] + newGeneral.data['dpi']) / 2).dp(2);
                            newGeneral.data['special'] = special;
                            if (it < len) {
                                general.records[it] = newGeneral.data;
                            } else {
                                $u.log(1, "Adding new 'General'", newGeneral.data['name']);
                                general.records.push(newGeneral.data);
                                update = true;
                            }

                            save = true;
                        } else {
                            $u.warn("Missing required 'General' attribute", index);
                        }
                    });

                    if (save) {
                        caap.stats['generals']['total'] = general.records.length;
                        caap.stats['generals']['invade'] = Math.min((caap.stats['army']['actual'] / 5).dp(), general.records.length);
                        general.save();
                        caap.saveStats();
                        if (update) {
                            general.UpdateDropDowns();
                        }
                    }

                    $u.log(3, "general.GetGenerals", general.records);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in general.GetGenerals: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        UpdateDropDowns: function () {
            try {
                var it       = 0,
                    len      = 0,
                    coolDown = '';

                general.BuildlLists();
                $u.log(3, "Updating 'General' Drop Down Lists");
                for (it = 0, len = general.StandardList.length; it < len; it += 1) {
                    caap.changeDropDownList(general.StandardList[it] + 'General', general.List, config.getItem(general.StandardList[it] + 'General', 'Use Current'));
                    coolDown = general.getCoolDownType(general.StandardList[it]);
                    if (coolDown) {
                        caap.changeDropDownList(coolDown, general.coolDownList, config.getItem(coolDown, ''));
                    }
                }

                if (coolDown && general.coolDownList.length > 1) {
                    $j("div[id*='_cool_row']", caap.caapDivObject).css("display", "block");
                    if (general.getItem("Zin", true) === false ? false : true) {
                        $j("div[id*='_zin_row']", caap.caapDivObject).css("display", "block");
                    }
                }

                caap.changeDropDownList('SubQuestGeneral', general.SubQuestList, config.getItem('SubQuestGeneral', 'Use Current'));
                caap.changeDropDownList('BuyGeneral', general.BuyList, config.getItem('BuyGeneral', 'Use Current'));
                caap.changeDropDownList('IncomeGeneral', general.IncomeList, config.getItem('IncomeGeneral', 'Use Current'));
                caap.changeDropDownList('BankingGeneral', general.BankingList, config.getItem('BankingGeneral', 'Use Current'));
                caap.changeDropDownList('CollectGeneral', general.CollectList, config.getItem('CollectGeneral', 'Use Current'));
                caap.changeDropDownList('LevelUpGeneral', general.List, config.getItem('LevelUpGeneral', 'Use Current'));
                return true;
            } catch (err) {
                $u.error("ERROR in general.UpdateDropDowns: " + err);
                return false;
            }
        },

        Clear: function (whichGeneral) {
            try {
                $u.log(1, 'Setting ' + whichGeneral + ' to "Use Current"');
                config.setItem(whichGeneral, 'Use Current');
                general.UpdateDropDowns();
                return true;
            } catch (err) {
                $u.error("ERROR in general.Clear: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        LevelUpCheck: function (whichGeneral) {
            try {
                var generalType = '',
                    use         = false,
                    keepGeneral = false;

                generalType = whichGeneral ? whichGeneral.replace(/General/i, '').trim() : '';
                if ((caap.stats['staminaT']['num'] > caap.stats['stamina']['max'] || caap.stats['energyT']['num'] > caap.stats['energy']['max']) && state.getItem('KeepLevelUpGeneral', false)) {
                    if (config.getItem(generalType + 'LevelUpGeneral', false)) {
                        $u.log(2, "Keep Level Up General");
                        keepGeneral = true;
                    } else {
                        $u.warn("User opted out of keep level up general for", generalType);
                    }
                } else if (state.getItem('KeepLevelUpGeneral', false)) {
                    $u.log(1, "Clearing Keep Level Up General flag");
                    state.setItem('KeepLevelUpGeneral', false);
                }

                if (config.getItem('LevelUpGeneral', 'Use Current') !== 'Use Current' && (general.StandardList.hasIndexOf(generalType) || generalType === 'Quest')) {
                    if (keepGeneral || (config.getItem(generalType + 'LevelUpGeneral', false) && caap.stats['exp']['dif'] && caap.stats['exp']['dif'] <= config.getItem('LevelUpGeneralExp', 0))) {
                        use = true;
                    }
                }

                return use;
            } catch (err) {
                $u.error("ERROR in general.LevelUpCheck: " + err);
                return undefined;
            }
        },

        getCoolDownType: function (whichGeneral) {
            try {
                var generalType = whichGeneral ? whichGeneral.replace(/General/i, '').trim() : '',
                    it          = 0,
                    ok          = false;

                for (it = 0; it < general.coolStandardList.length; it += 1) {
                    if (general.coolStandardList[it] === generalType) {
                        ok = true;
                        break;
                    }
                }

                generalType = ok ? (generalType ? generalType + "CoolGeneral" : '') : '';
                return generalType;
            } catch (err) {
                $u.error("ERROR in general.getCoolDownType: " + err);
                return undefined;
            }
        },

        Select: function (whichGeneral) {
            try {
                var generalName       = '',
                    getCurrentGeneral = '',
                    currentGeneral    = '',
                    generalImage      = '',
                    levelUp           = general.LevelUpCheck(whichGeneral),
                    coolType          = general.getCoolDownType(whichGeneral),
                    coolName          = coolType ? config.getItem(coolType, '') : '',
                    coolRecord        = coolName ? general.getItem(coolName) : {},
                    zinRecord         = general.getItem("Zin", true),
                    zinReady          = zinRecord && !$j.isEmptyObject(zinRecord) ? caap.stats['stamina']['num'] <= (caap.stats['stamina']['max'] - 15) && zinRecord['charge'] === 100 : false,
                    coolZin           = coolName === "Zin" ? caap.stats['stamina']['num'] > (caap.stats['stamina']['max'] - 15) : false,
                    useCool           = coolName && !coolZin && !$j.isEmptyObject(coolRecord) && coolRecord['charge'] === 100,
                    zinFirst          = config.getItem("useZinFirst", true);

                $u.log(3, 'Cool', useCool, coolZin, coolType, coolName, coolRecord);
                $u.log(3, 'Zin', zinReady, zinFirst, zinRecord);
                if (levelUp) {
                    whichGeneral = 'LevelUpGeneral';
                    $u.log(2, 'Using level up general');
                }

                generalName = zinReady && zinFirst && coolType ? "Zin" : (useCool ? coolName : config.getItem(whichGeneral, 'Use Current'));
                if (!generalName || /use current/i.test(generalName)) {
                    return false;
                }

                if (!levelUp && /under level/i.test(generalName)) {
                    if (!general.GetLevelUpNames().length) {
                        return general.Clear(whichGeneral);
                    }

                    generalName = config.getItem('ReverseLevelUpGenerals') ? general.GetLevelUpNames().reverse().pop() : generalName = general.GetLevelUpNames().pop();
                }

                getCurrentGeneral = general.GetCurrent();
                if (!getCurrentGeneral) {
                    caap.reloadCastleAge(true);
                }

                currentGeneral = getCurrentGeneral;
                if (generalName.hasIndexOf(currentGeneral)) {
                    return false;
                }

                $u.log(1, 'Changing from ' + currentGeneral + ' to ' + generalName);
                if (caap.navigateTo('mercenary,generals', 'tab_generals_on.gif')) {
                    return true;
                }

                generalImage = general.GetImage(generalName);
                if (caap.hasImage(generalImage)) {
                    return caap.navigateTo(generalImage);
                }

                caap.setDivContent('Could not find ' + generalName);
                $u.warn('Could not find', generalName, generalImage);
                if (config.getItem('ignoreGeneralImage', true)) {
                    return false;
                } else {
                    return general.Clear(whichGeneral);
                }
            } catch (err) {
                $u.error("ERROR in general.Select: " + err);
                return false;
            }
        },

        quickSwitch: false,

        GetEquippedStats: function () {
            try {
                general.quickSwitch = false;
                var generalName  = general.GetCurrent(),
                    it           = 0,
                    len          = 0,
                    generalDiv   = $j("#" + caap.domain.id[caap.domain.which] + "equippedGeneralContainer .generals_indv_stats div", caap.globalContainer),
                    tempObj      = $j(),
                    success      = false;

                if (generalName === 'Use Current') {
                    return false;
                }

                $u.log(2, "Equipped 'General'", generalName);
                for (it = 0, len = general.records.length; it < len; it += 1) {
                    if (general.records[it]['name'] === generalName) {
                        break;
                    }
                }

                if (it >= len) {
                    $u.warn("Unable to find 'General' record");
                    return false;
                }

                if ($u.hasContent(generalDiv) && generalDiv.length === 2) {
                    tempObj = generalDiv.eq(0);
                    if ($u.hasContent(tempObj)) {
                        general.records[it]['eatk'] = $u.setContent(tempObj.text(), '0').parseInt();
                        tempObj = generalDiv.eq(1);
                        if ($u.hasContent(tempObj)) {
                            general.records[it]['edef'] = $u.setContent(tempObj.text(), '0').parseInt();
                            success = true;
                        } else {
                            $u.warn("Unable to get 'General' defense object");
                        }
                    } else {
                        $u.warn("Unable to get 'General' attack object");
                    }

                    if (success) {
                        general.records[it]['eapi'] = (general.records[it]['eatk'] + (general.records[it]['edef'] * 0.7)).dp(2);
                        general.records[it]['edpi'] = (general.records[it]['edef'] + (general.records[it]['eatk'] * 0.7)).dp(2);
                        general.records[it]['empi'] = ((general.records[it]['eapi'] + general.records[it]['edpi']) / 2).dp(2);
                        general.records[it]['energyMax'] = caap.stats['energyT']['max'];
                        general.records[it]['staminaMax'] = caap.stats['staminaT']['max'];
                        general.records[it]['healthMax'] = caap.stats['healthT']['max'];
                        general.records[it]['last'] = new Date().getTime();
                        general.save();
                        $u.log(3, "Got 'General' stats", general.records[it]);
                    } else {
                        $u.warn("Unable to get 'General' stats");
                    }
                } else {
                    $u.warn("Unable to get equipped 'General' divs");
                }

                return general.records[it];
            } catch (err) {
                $u.error("ERROR in general.GetEquippedStats: " + err);
                return false;
            }
        },

        GetAllStats: function () {
            try {
                var generalImage = '',
                    it           = 0,
                    len          = 0,
                    theGeneral   = '',
                    time         = config.getItem("GeneralLastReviewed", 24);

                time = (time < 24 ? 24 : time) * 3600;
                for (it = 0, len = general.records.length; it < len; it += 1) {
                    if (schedule.since(general.records[it]['last'], time)) {
                        break;
                    }
                }

                if (it >= len) {
                    time = config.getItem("GetAllGenerals", 7);
                    time = (time < 7 ? 7 : time) * 86400;
                    schedule.setItem("allGenerals", time, 300);
                    $u.log(2, "Finished visiting all Generals for their stats");
                    theGeneral = config.getItem('IdleGeneral', 'Use Current');
                    if (theGeneral !== 'Use Current') {
                        $u.log(2, "Changing to idle general");
                        return general.Select('IdleGeneral');
                    }

                    return false;
                }

                if (caap.navigateTo('mercenary,generals', 'tab_generals_on.gif')) {
                    $u.log(2, "Visiting generals to get 'General' stats");
                    return true;
                }

                generalImage = general.GetImage(general.records[it]['name']);
                if (caap.hasImage(generalImage)) {
                    if (general.GetCurrent() !== general.records[it]['name']) {
                        $u.log(2, "Visiting 'General'", general.records[it]['name']);
                        return caap.navigateTo(generalImage);
                    }
                }

                return true;
            } catch (err) {
                $u.error("ERROR in general.GetAllStats: " + err);
                return false;
            }
        },

        owned: function (name) {
            try {
                var it    = 0,
                    owned = false;

                for (it = general.records.length - 1; it >= 0; it -= 1) {
                    if (general.records[it]['name'] && general.records[it]['name'] === name) {
                        owned = true;
                        break;
                    }
                }

                return owned;
            } catch (err) {
                $u.error("ERROR in general.owned: " + err);
                return undefined;
            }
        },

        menu: function () {
            try {
                // Add General Comboboxes
                var reverseGenInstructions = "This will make the script level Generals under max level from Top-down instead of Bottom-up",
                    ignoreGeneralImage = "This will prevent the script " +
                        "from changing your selected General to 'Use Current' if the script " +
                        "is unable to find the General's image when changing activities. " +
                        "Instead it will use the current General for the activity and try " +
                        "to select the correct General again next time.",
                    LevelUpGenExpInstructions = "Specify the number of experience " +
                        "points below the next level up to begin using the level up general.",
                    LevelUpGenInstructions1 = "Use the Level Up General for Idle mode.",
                    LevelUpGenInstructions2 = "Use the Level Up General for Monster mode.",
                    LevelUpGenInstructions3 = "Use the Level Up General for Fortify mode.",
                    LevelUpGenInstructions4 = "Use the Level Up General for Invade mode.",
                    LevelUpGenInstructions5 = "Use the Level Up General for Duel mode.",
                    LevelUpGenInstructions6 = "Use the Level Up General for War mode.",
                    LevelUpGenInstructions7 = "Use the Level Up General for doing sub-quests.",
                    LevelUpGenInstructions8 = "Use the Level Up General for doing primary quests " +
                        "(Warning: May cause you not to gain influence if wrong general is equipped.)",
                    LevelUpGenInstructions9 = "Ignore Banking until level up energy and stamina gains have been used.",
                    LevelUpGenInstructions10 = "Ignore Income until level up energy and stamina gains have been used.",
                    LevelUpGenInstructions11 = "EXPERIMENTAL: Enables the Quest 'Not Fortifying' mode after level up.",
                    LevelUpGenInstructions12 = "Use the Level Up General for Guild Monster mode.",
                    //LevelUpGenInstructions13 = "Use the Level Up General for Arena mode.",
                    LevelUpGenInstructions14 = "Use the Level Up General for Buy mode.",
                    LevelUpGenInstructions15 = "Use the Level Up General for Collect mode.",
                    //LevelUpGenInstructions16 = "Use the Level Up General for Festival Guild Battles mode.",
                    dropDownItem = 0,
                    coolDown = '',
                    haveZin = general.getItem("Zin", true) === false ? false : true,
                    htmlCode = '';

                htmlCode += caap.startToggle('Generals', 'GENERALS');
                htmlCode += caap.makeCheckTR("Use Zin First", 'useZinFirst', true, 'If Zin is charged then use her first as long as you are 15 or less points from maximum stamina.', false, false, '', '_zin_row', haveZin ? "display: block;" : "display: none;");
                htmlCode += caap.makeCheckTR("Do not reset General", 'ignoreGeneralImage', true, ignoreGeneralImage);
                for (dropDownItem = 0; dropDownItem < general.StandardList.length; dropDownItem += 1) {
                    htmlCode += caap.makeDropDownTR(general.StandardList[dropDownItem], general.StandardList[dropDownItem] + 'General', general.List, '', '', 'Use Current', false, false, 62);
                    coolDown = general.getCoolDownType(general.StandardList[dropDownItem]);
                    htmlCode += coolDown ? caap.makeDropDownTR("Cool", coolDown, general.coolDownList, '', '', '', true, false, 62, '', '_cool_row', general.coolDownList.length > 1 ? "display: block;" : "display: none;") : '';
                }

                htmlCode += caap.makeDropDownTR("SubQuest", 'SubQuestGeneral', general.SubQuestList, '', '', 'Use Current', false, false, 62);
                htmlCode += caap.makeDropDownTR("Buy", 'BuyGeneral', general.BuyList, '', '', 'Use Current', false, false, 62);
                htmlCode += caap.makeDropDownTR("Collect", 'CollectGeneral', general.CollectList, '', '', 'Use Current', false, false, 62);
                htmlCode += caap.makeDropDownTR("Income", 'IncomeGeneral', general.IncomeList, '', '', 'Use Current', false, false, 62);
                htmlCode += caap.makeDropDownTR("Banking", 'BankingGeneral', general.BankingList, '', '', 'Use Current', false, false, 62);
                htmlCode += caap.makeDropDownTR("Level Up", 'LevelUpGeneral', general.List, '', '', 'Use Current', false, false, 62);
                htmlCode += caap.startDropHide('LevelUpGeneral', '', 'Use Current', true);
                htmlCode += caap.makeNumberFormTR("Exp To Use Gen", 'LevelUpGeneralExp', LevelUpGenExpInstructions, 20, '', '', true, false);
                htmlCode += caap.makeCheckTR("Gen For Idle", 'IdleLevelUpGeneral', true, LevelUpGenInstructions1, true, false);
                htmlCode += caap.makeCheckTR("Gen For Monsters", 'MonsterLevelUpGeneral', true, LevelUpGenInstructions2, true, false);
                htmlCode += caap.makeCheckTR("Gen For Guild Monsters", 'GuildMonsterLevelUpGeneral', true, LevelUpGenInstructions12, true, false);
                htmlCode += caap.makeCheckTR("Gen For Fortify", 'FortifyLevelUpGeneral', true, LevelUpGenInstructions3, true, false);
                htmlCode += caap.makeCheckTR("Gen For Invades", 'InvadeLevelUpGeneral', true, LevelUpGenInstructions4, true, false);
                htmlCode += caap.makeCheckTR("Gen For Duels", 'DuelLevelUpGeneral', true, LevelUpGenInstructions5, true, false);
                htmlCode += caap.makeCheckTR("Gen For Wars", 'WarLevelUpGeneral', true, LevelUpGenInstructions6, true, false);
                //htmlCode += caap.makeCheckTR("Gen For Arena", 'ArenaLevelUpGeneral', true, LevelUpGenInstructions13, true, false);
                //htmlCode += caap.makeCheckTR("Gen For Festival", 'FestivalLevelUpGeneral', true, LevelUpGenInstructions16, true, false);
                htmlCode += caap.makeCheckTR("Gen For SubQuests", 'SubQuestLevelUpGeneral', true, LevelUpGenInstructions7, true, false);
                htmlCode += caap.makeCheckTR("Gen For Buy", 'BuyLevelUpGeneral', true, LevelUpGenInstructions14, true, false);
                htmlCode += caap.makeCheckTR("Gen For Collect", 'CollectLevelUpGeneral', true, LevelUpGenInstructions15, true, false);
                htmlCode += caap.makeCheckTR("Gen For MainQuests", 'QuestLevelUpGeneral', false, LevelUpGenInstructions8, true, false);
                htmlCode += caap.makeCheckTR("Don't Bank After", 'NoBankAfterLvl', true, LevelUpGenInstructions9, true, false);
                htmlCode += caap.makeCheckTR("Don't Income After", 'NoIncomeAfterLvl', true, LevelUpGenInstructions10, true, false);
                htmlCode += caap.makeCheckTR("Prioritise Monster After", 'PrioritiseMonsterAfterLvl', false, LevelUpGenInstructions11, true, false);
                htmlCode += caap.endDropHide('LevelUpGeneral');
                htmlCode += caap.makeCheckTR("Reverse Under Level Order", 'ReverseLevelUpGenerals', false, reverseGenInstructions);
                htmlCode += caap.makeCheckTR("Modify Timers", 'generalModifyTimers', false, "Advanced timers for how often General checks are performed.");
                htmlCode += caap.startCheckHide('generalModifyTimers');
                htmlCode += caap.makeNumberFormTR("List Hours", 'checkGenerals', "Check the Generals list every X hours. Minimum 24.", 24, '', '', true);
                htmlCode += caap.makeNumberFormTR("Scan Days", 'GetAllGenerals', "Scan the Generals every X days. Minimum 7.", 7, '', '', true);
                htmlCode += caap.makeNumberFormTR("Checked Hours", 'GeneralLastReviewed', "Check the General during the scan if not visited in the last X hours. Minimum 24.", 24, '', '', true);
                htmlCode += caap.endCheckHide('generalModifyTimers');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in general.menu: " + err);
                return '';
            }
        },

        dashboard: function () {
            try {
                /*-------------------------------------------------------------------------------------\
                Next we build the HTML to be included into the 'caap_generalsStats' div. We set our
                table and then build the header row.
                \-------------------------------------------------------------------------------------*/
                if (config.getItem('DBDisplay', '') === 'Generals Stats' && state.getItem("GeneralsDashUpdate", true)) {
                    var headers       = ['General', 'Lvl', 'Atk', 'Def', 'API', 'DPI', 'MPI', 'EAtk', 'EDef', 'EAPI', 'EDPI', 'EMPI', 'Special'],
                        values        = ['name', 'lvl', 'atk', 'def', 'api', 'dpi', 'mpi', 'eatk', 'edef', 'eapi', 'edpi', 'empi', 'special'],
                        pp            = 0,
                        link          = '',
                        instructions  = '',
                        it            = 0,
                        len           = 0,
                        len1          = 0,
                        data          = {text: '', color: '', bgcolor: '', id: '',  title: ''},
                        header        = {text: '', color: '', bgcolor: '', id: '', title: '', width: ''},
                        handler       = null,
                        head          = '',
                        body          = '',
                        row           = '';

                    for (pp = 0, len = headers.length; pp < len; pp += 1) {
                        header = {
                            text  : headers[pp],
                            color : '',
                            id    : '',
                            title : '',
                            width : '7%'
                        };

                        switch (headers[pp]) {
                        case 'General' :
                            header.width = '13%';
                            break;
                        case 'Lvl' :
                        case 'Atk' :
                        case 'Def' :
                        case 'API' :
                        case 'DPI' :
                        case 'MPI' :
                            header.width = '5.5%';
                            break;
                        case 'Special' :
                            header.width = '19%';
                            break;
                        default:
                        }

                        head += caap.makeTh(header);
                    }

                    head = caap.makeTr(head);
                    for (it = 0, len = general.records.length; it < len; it += 1) {
                        row = "";
                        for (pp = 0, len1 = values.length; pp < len1; pp += 1) {
                            if (values[pp] === 'name') {
                                link = "generals.php?itype=" + general.records[it]['itype'] + "&item=" + general.records[it]['item'];
                                instructions = "Clicking this link will change General to " + general.records[it]['name'];
                                data = {
                                    text  : '<span id="caap_general_' + it + '" title="' + instructions + '" mname="' + general.records[it]['name'] + '" rlink="' + link +
                                            '" onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';">' + general.records[it]['name'] + '</span>',
                                    color : 'blue',
                                    id    : '',
                                    title : ''
                                };

                                row += caap.makeTd(data);
                            } else {
                                row += caap.makeTd({text: $u.setContent(general.records[it][values[pp]], ''), color: '', title: ''});
                            }
                        }

                        body += caap.makeTr(row);
                    }

                    $j("#caap_generalsStats", caap.caapTopObject).html(
                        $j(caap.makeTable("general", head, body)).dataTable({
                            "bAutoWidth"    : false,
                            "bFilter"       : false,
                            "bJQueryUI"     : false,
                            "bInfo"         : false,
                            "bLengthChange" : false,
                            "bPaginate"     : false,
                            "bProcessing"   : false,
                            "bStateSave"    : true,
                            "bSortClasses"  : false,
                            "aoColumnDefs"  : [{
                                "bSortable" : false,
                                "aTargets"  : [12]
                            }]
                        })
                    );

                    handler = function (e) {
                        var changeLink = {
                                mname     : '',
                                rlink     : ''
                            },
                            container  = '',
                            i          = 0,
                            len        = 0,
                            clickUrl   = state.getItem('clickUrl', '');

                        for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                            if (e.target.attributes[i].nodeName === 'mname') {
                                changeLink.mname = e.target.attributes[i].nodeValue;
                            } else if (e.target.attributes[i].nodeName === 'rlink') {
                                changeLink.rlink = e.target.attributes[i].nodeValue;
                            }
                        }

                        if (clickUrl.hasIndexOf("generals.php")) {
                            container = "#" + caap.domain.id[caap.domain.which] + "globalContainer";
                            caap.ajaxLoad(changeLink.rlink, container, "", clickUrl);
                        } else {
                            general.quickSwitch = true;
                            container = "#" + caap.domain.id[caap.domain.which] + "equippedGeneralContainer";
                            caap.ajaxLoad(changeLink.rlink, container, container, clickUrl);
                        }
                    };

                    $j("span[id*='caap_general_']", caap.caapTopObject).unbind('click', handler).click(handler);

                    state.setItem("GeneralsDashUpdate", false);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in general.dashboard: " + err);
                return false;
            }
        }
        /*jslint sub: false */
    };

    ////////////////////////////////////////////////////////////////////
    //                          monster OBJECT
    // this is the main object for dealing with Monsters
    /////////////////////////////////////////////////////////////////////

    monster = {
        records: [],

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        record: function () {
            this.data = {
                'name'       : '',
                'userName'   : '',
                'userId'     : 0,
                'monster'    : '',
                'md5'        : '',
                'attacked'   : -1,
                'defended'   : -1,
                'damage'     : -1,
                'life'       : -1,
                'fortify'    : -1,
                'time'       : [],
                't2k'        : -1,
                'phase'      : '',
                'miss'       : 0,
                'feedLink'   : '',
                'link'       : '',
                'rix'        : -1,
                'mpool'      : '',
                'mid'        : '',
                'over'       : '',
                'page'       : '',
                'color'      : '',
                'review'     : -1,
                'type'       : '',
                'conditions' : '',
                'charClass'  : '',
                'strength'   : -1,
                'stun'       : -1,
                'stunTime'   : -1,
                'stunDo'     : false,
                'stunType'   : '',
                'tip'        : '',
                'fImg'       : '',
                'hide'       : false,
                'save'       : true,
                'joinable'   : {},
                'joined'     : false,
                'select'     : false
            };
        },
        /*jslint sub: false */

        engageButtons: {},

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        completeButton: {
            'battle_monster': {
                'name'   : undefined,
                'button' : undefined
            },
            'raid': {
                'name'   : undefined,
                'button' : undefined
            }
        },
        /*jslint sub: false */

        // http://castleage.wikidot.com/monster for monster info
        // http://castleage.wikidot.com/skaar
        info: {
            'Skaar Deathrune' : {
                duration     : 96,
                defense      : true,
                hp           : 100000000,
                ach          : 1000000,
                siege        : 5,
                siegeClicks  : [30, 60, 90, 120, 200],
                siegeDam     : [6600000, 8250000, 9900000, 13200000, 16500000],
                siege_img    : ['/graphics/death_siege_small'],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                reqAtkButton : 'attack_monster_button.jpg',
                v            : 'attack_monster_button2.jpg',
                defButton    : 'button_dispel.gif',
                defense_img  : 'bar_dispel.gif',
                levels       : [1,  30, 60, 90],
                join         : [30, 50, 70, 70],
                mClass       : 'Epic Boss',
                mpool        : 1,
                festival_img : ['festival_monsters_top_skaar_boss.jpg'],
                festival_dur : 120,
                festival_ach : 1000000,
                newbg_img    : ['monster_header_skaar.jpg'],
                list_img     : ['death_list.jpg'],
                cta_img      : ['ntwitter_deathrune1.gif']
            },
            'Ragnarok, The Ice Elemental' : {
                duration     : 168,
                defense      : true,
                hp           : 100000000,
                ach          : 1000000,
                siege        : 5,
                siegeClicks  : [30, 60, 90, 120, 200],
                siegeDam     : [7260000, 9075000, 10890000, 14520000, 18150000],
                siege_img    : ['/graphics/water_siege_small'],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                reqAtkButton : 'attack_monster_button.jpg',
                pwrAtkButton : 'attack_monster_button2.jpg',
                defButton    : 'button_dispel.gif',
                defense_img  : 'bar_dispel.gif',
                levels       : [1,  30, 60, 90],
                join         : [30, 50, 70, 70],
                mClass       : 'Epic World',
                mpool        : 3,
                festival_img : ['festival_monsters_top_water_element.jpg'],
                festival_dur : 192,
                festival_ach : 1000000,
                newbg_img    : [
                    'monster_header_ragnorak.jpg',
                    'monster_header_ragnarok.jpg'
                ],
                list_img     : ['water_list.jpg'],
                cta_img      : ['ntwitter_ragnarok1.gif']
            },
            'Genesis, The Earth Elemental' : {
                duration     : 168,
                defense      : true,
                hp           : 100000000,
                ach          : 1000000,
                siege        : 5,
                siegeClicks  : [30, 60, 90, 120, 200],
                siegeDam     : [6600000, 8250000, 9900000, 13200000, 16500000],
                siege_img    : ['/graphics/earth_siege_small'],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                reqAtkButton : 'attack_monster_button.jpg',
                pwrAtkButton : 'attack_monster_button2.jpg',
                defButton    : 'attack_monster_button3.jpg',
                defense_img  : 'seamonster_ship_health.jpg',
                repair_img   : 'repair_bar_grey.jpg',
                levels       : [1,  30, 60, 90],
                join         : [30, 30, 30, 40],
                mClass       : 'Epic World',
                mpool        : 3,
                festival_img : ['festival_monsters_top_earth_element.jpg'],
                festival_dur : 192,
                festival_ach : 1000000,
                newbg_img    : ['monster_header_genesis.jpg'],
                list_img     : ['earth_element_list.jpg'],
                cta_img      : ['ntwitter_genesis1.gif']
            },
            'Cronus, The World Hydra' : {
                duration     : 168,
                hp           : 100000000,
                ach          : 500000,
                siege        : 6,
                siegeClicks  : [10, 20, 50, 100, 200, 300],
                siegeDam     : [1340000, 2680000, 5360000, 14700000, 28200000, 37520000],
                siege_img    : ['/graphics/monster_siege_small'],
                staUse       : 10,
                staLvl       : [0, 100, 200, 400, 400],
                staMax       : [10, 20, 50,  100, 200],
                levels       : [1,  30, 60, 90],
                join         : [40, 30, 30, 30],
                mClass       : 'Epic World',
                mpool        : 3,
                festival_img : ['festival_monsters_top_hydra.jpg'],
                festival_dur : 192,
                festival_ach : 500000,
                newbg_img    : ['monster_header_cronus.jpg'],
                list_img     : ['hydra_head.jpg'],
                cta_img      : [
                    'cta_hydra_catapult.gif',
                    'cta_hydra_arrows.gif',
                    'cta_hydra_cannons.gif',
                    'cta_hydra_blizzard.gif',
                    'cta_hydra_firestorm.gif'
                ]
            },
            'Battle Of The Dark Legion' : {
                duration     : 168,
                hp           : 100000,
                ach          : 1000,
                siege        : 6,
                siegeClicks  : [10, 20, 40, 80, 150, 300],
                siegeDam     : [3000, 4500, 6000, 9000, 12000, 15000],
                siege_img    : ['/graphics/castle_siege_small'],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                defense_img  : 'seamonster_ship_health.jpg',
                repair_img   : 'repair_bar_grey.jpg',
                levels       : [1,  30, 60, 90],
                join         : [30, 30, 30, 40],
                mClass       : 'Epic World',
                mpool        : 3,
                newbg_img    : ['monster_header_defend.jpg'],
                list_img     : ['castle_siege_list.jpg'],
                cta_img      : [
                    'cta_castle_archers.gif',
                    'cta_castle_elves.gif',
                    'cta_castle_dwarves.gif',
                    'cta_castle_knights.gif'
                ]
            },
            'Emerald Dragon' : {
                duration     : 72,
                ach          : 100000,
                siege        : 0,
                staUse       : 5,
                staMax       : [5, 10],
                attack_img   : [
                    'seamonster_power.gif',
                    'serpent_10stam_attack.gif'
                ],
                mClass       : 'Epic Team',
                mpool        : 2,
                newbg_img    : ['monster_header_emeralddrag.jpg'],
                list_img     : ['dragon_list_green.jpg'],
                cta_img      : ['cta_green_dragon.gif']
            },
            'Frost Dragon' : {
                duration     : 72,
                ach          : 100000,
                siege        : 0,
                staUse       : 5,
                staMax       : [5, 10],
                attack_img   : [
                    'seamonster_power.gif',
                    'serpent_10stam_attack.gif'
                ],
                mClass       : 'Epic Team',
                mpool        : 2,
                festival_img : ['festival_monsters_top_dragon_blue.jpg'],
                festival_dur : 96,
                festival_ach : 30000,
                newbg_img    : ['monster_header_frostdrag.jpg'],
                list_img     : ['dragon_list_blue.jpg'],
                cta_img      : ['cta_blue_dragon.gif']
            },
            'Gold Dragon' : {
                duration     : 72,
                ach          : 100000,
                siege        : 0,
                staUse       : 5,
                staMax       : [5, 10],
                attack_img   : [
                    'seamonster_power.gif',
                    'serpent_10stam_attack.gif'
                ],
                mClass       : 'Epic Team',
                mpool        : 2,
                festival_img : ['festival_monsters_top_dragon_yellow.jpg'],
                festival_dur : 96,
                festival_ach : 30000,
                newbg_img    : ['monster_header_golddrag.jpg'],
                list_img     : ['dragon_list_yellow.jpg'],
                cta_img      : ['cta_yellow_dragon.gif']
            },
            'Ancient Red Dragon' : {
                duration     : 72,
                ach          : 100000,
                siege        : 0,
                staUse       : 5,
                staMax       : [5, 10],
                attack_img   : [
                    'seamonster_power.gif',
                    'serpent_10stam_attack.gif'
                ],
                mClass       : 'Epic Team',
                mpool        : 2,
                festival_img : ['festival_monsters_top_dragon_red.jpg',
                                'festival_monsters_top_dragon_monster.jpg'],
                festival_dur : 96,
                festival_ach : 50000,
                newbg_img    : ['monster_header_ancientreddrag.jpg'],
                list_img     : ['dragon_list_red.jpg'],
                cta_img      : ['cta_red_dragon.gif']
            },
            'Karn'      : {
                duration     : 120,
                ach          : 15000,
                siege        : 0,
                mClass       : 'Quest Mini-Boss',
                mpool        : 4,
                newbg_img    : ['monster_header_minotaur.jpg'],
                list_img     : ['monster_minotaur_list.jpg']
            },
            'Gildamesh, The Orc King'      : {
                duration     : 72,
                ach          : 15000,
                siege        : 0,
                mClass       : 'Epic Boss',
                mpool        : 1,
                festival_img : ['festival_monsters_top_orcking.jpg'],
                festival_dur : 96,
                festival_ach : 30000,
                newbg_img    : ['monster_header_gildamesh.jpg'],
                list_img     : ['orc_boss_list.jpg'],
                cta_img      : ['cta_orc_king.gif']
            },
            'Colossus Of Terra'     : {
                duration     : 72,
                ach          : 20000,
                siege        : 0,
                mClass       : 'Epic Boss',
                mpool        : 1,
                festival_img : ['festival_monsters_top_stonegiant.jpg'],
                festival_dur : 96,
                festival_ach : 30000,
                newbg_img    : ['monster_header_colossus.jpg'],
                list_img     : ['stone_giant_list.jpg'],
                cta_img      : ['cta_stone.gif']
            },
            'Sylvanas The Sorceress Queen'     : {
                duration     : 48,
                ach          : 50000,
                siege        : 1,
                siegeClicks  : [11],
                siegeDam     : [500000],
                siege_img    : ['/graphics/boss_sylvanas_drain_icon.gif'],
                mClass       : 'Epic Boss',
                mpool        : 1,
                festival_img : ['festival_monsters_top_sylvanus.jpg'],
                festival_dur : 72,
                festival_ach : 30000,
                newbg_img    : [
                    'monster_header_sylvanas.jpg',
                    'monster_header_sylvana.jpg'
                ],
                list_img     : ['boss_sylvanus_list.jpg'],
                cta_img      : ['cta_sylvanas.gif']
            },
            'Lotus Ravenmoore' : {
                duration     : 48,
                ach          : 500000,
                siege        : 0,
                mClass       : 'Epic Boss',
                mpool        : 1,
                newbg_img    : ['monster_header_lotus.jpg'],
                list_img     : ['boss_lotus_list.jpg'],
                cta_img      : ['cta_lotus.gif']
            },
            'Keira The Dread Knight'    : {
                duration     : 48,
                ach          : 30000,
                siege        : 0,
                reqAtkButton : 'event_attack1.gif',
                pwrAtkButton : 'event_attack2.gif',
                //defButton    : null,
                mClass       : 'Epic Boss',
                mpool        : 1,
                newbg_img    : [
                    'monster_header_keira.jpg',
                    'monster_header_keira2.jpg'
                ],
                list_img     : ['boss_keira_list.jpg'],
                cta_img      : ['cta_keira.gif']
            },
            'Amethyst Sea Serpent'   : {
                duration     : 72,
                defense      : true,
                ach          : 250000,
                siege        : 0,
                fort         : true,
                staUse       : 10,
                staMax       : [10, 20],
                attack_img   : [
                    'serpent_10stam_attack.gif',
                    'serpent_20stam_attack.gif'
                ],
                fortify_img  : ['seamonster_fortify.gif'],
                defense_img  : 'seamonster_ship_health.jpg',
                mClass       : 'Epic Team',
                mpool        : 2,
                festival_img : ['festival_monsters_top_seamonster_purple.jpg'],
                festival_dur : 96,
                festival_ach : 30000,
                newbg_img    : ['monster_header_amyserpent.jpg'],
                list_img     : ['seamonster_list_purple.jpg'],
                cta_img      : ['twitter_seamonster_purple_1.jpg']
            },
            'Ancient Sea Serpent'   : {
                duration     : 72,
                defense      : true,
                ach          : 250000,
                siege        : 0,
                fort         : true,
                staUse       : 10,
                staMax       : [10, 20],
                attack_img   : [
                    'serpent_10stam_attack.gif',
                    'serpent_20stam_attack.gif'
                ],
                fortify_img  : ['seamonster_fortify.gif'],
                defense_img  : 'seamonster_ship_health.jpg',
                mClass       : 'Epic Team',
                mpool        : 2,
                festival_img : ['festival_monsters_top_seamonster_red.jpg'],
                festival_dur : 96,
                festival_ach : 30000,
                newbg_img    : ['monster_header_ancientserpent.jpg'],
                list_img     : ['seamonster_list_red.jpg'],
                cta_img      : ['twitter_seamonster_red_1.jpg']
            },
            'Emerald Sea Serpent'   : {
                duration     : 72,
                defense      : true,
                ach          : 250000,
                siege        : 0,
                fort         : true,
                staUse       : 10,
                staMax       : [10, 20],
                attack_img   : [
                    'serpent_10stam_attack.gif',
                    'serpent_20stam_attack.gif'
                ],
                fortify_img  : ['seamonster_fortify.gif'],
                defense_img  : 'seamonster_ship_health.jpg',
                mClass       : 'Epic Team',
                mpool        : 2,
                festival_img : ['festival_monsters_top_seamonster_green.jpg'],
                festival_dur : 96,
                festival_ach : 30000,
                newbg_img    : ['monster_header_emeraldserpent.jpg'],
                list_img     : ['seamonster_list_green.jpg'],
                cta_img      : ['twitter_seamonster_green_1.jpg']
            },
            'Sapphire Sea Serpent'   : {
                duration     : 72,
                defense      : true,
                ach          : 250000,
                siege        : 0,
                fort         : true,
                staUse       : 10,
                staMax       : [10, 20],
                attack_img   : [
                    'serpent_10stam_attack.gif',
                    'serpent_20stam_attack.gif'
                ],
                fortify_img  : ['seamonster_fortify.gif'],
                defense_img  : 'seamonster_ship_health.jpg',
                mClass       : 'Epic Team',
                mpool        : 2,
                festival_img : ['festival_monsters_top_seamonster_blue.jpg'],
                festival_dur : 96,
                festival_ach : 30000,
                newbg_img    : ['monster_header_sapphserpent.jpg'],
                list_img     : ['seamonster_list_blue.jpg'],
                cta_img      : ['twitter_seamonster_blue_1.jpg']
            },
            'The Deathrune Siege'    : {
                duration     : 232,
                ach          : 100,
                siege        : 2,
                siegeClicks  : [80,  100],
                siegeDam     : [300, 1500],
                siege_img    : ['/graphics/monster_siege_'],
                staUse       : 1,
                stage1       : {
                    duration     : 88,
                    ach          : 50,
                    siege        : 1,
                    siegeClicks  : [80],
                    siegeDam     : [300],
                    siege_img    : ['/graphics/monster_siege_'],
                    staUse       : 1
                },
                stage2       : {
                    duration     : 144,
                    ach          : 100,
                    siege        : 2,
                    siegeClicks  : [80,  100],
                    siegeDam     : [300, 1500],
                    siege_img    : ['/graphics/monster_siege_'],
                    staUse       : 1
                },
                cta_img      : ['ntwitter_raid1.gif']
            },
            'Mephistopheles' : {
                duration     : 48,
                ach          : 200000,
                siege        : 0,
                mClass       : 'Epic Boss',
                mpool        : 1,
                festival_img : ['festival_monsters_top_mephistopheles.jpg'],
                festival_dur : 89,
                festival_ach : 50000,
                newbg_img    : ['monster_header_meph.jpg'],
                list_img     : ['boss_mephistopheles_list.jpg'],
                cta_img      : ['cta_mephi.gif']
            },
            // http://castleage.wikia.com/wiki/War_of_the_Red_Plains
            'War Of The Red Plains' : {
                alpha        : true,
                tactics      : true,
                duration     : 168,
                hp           : 350000000,
                ach          : 10000,
                siege        : 7,
                siegeClicks  : [30, 60, 90, 120, 200, 250, 300],
                siegeDam     : [13750000, 17500000, 20500000, 23375000, 26500000, 29500000, 34250000],
                siege_img    : [
                    '/graphics/water_siege_small',
                    '/graphics/alpha_bahamut_siege_blizzard_2',
                    '/graphics/azriel_siege_inferno_2',
                    '/graphics/war_siege_holy_smite_2'
                ],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 30,  45],
                mClass       : 'Epic World',
                mpool        : 3,
                newbg_img    : ['monster_header_warredplains.jpg'],
                list_img     : ['nm_war_list.jpg'],
                cta_img      : ['nm_war_twitter_1.gif']
            },
            // http://castleage.wikia.com/wiki/Bahamut,_the_Volcanic_Dragon
            'Bahamut, The Volcanic Dragon' : {
                alpha        : true,
                duration     : 168,
                hp           : 130000000,
                ach          : 4000000,
                siege        : 5,
                siegeClicks  : [30, 60, 90, 120, 200],
                siegeDam     : [7896000, 9982500, 11979000, 15972000, 19965000],
                siege_img    : ['/graphics/water_siege_small'],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 30,  20],
                mClass       : 'Epic World',
                mpool        : 3,
                festival_img : ['festival_monsters_top_volcanic_new.jpg'],
                festival_dur : 192,
                festival_ach : 1000000,
                newbg_img    : ['monster_header_bahamut.jpg'],
                list_img     : ['nm_volcanic_list.jpg'],
                cta_img      : ['ntwitter_volcanic1.gif']
            },
            // http://castleage.wikidot.com/alpha-bahamut
            // http://castleage.wikia.com/wiki/Alpha_Bahamut,_The_Volcanic_Dragon
            'Alpha Bahamut, The Volcanic Dragon' : {
                alpha        : true,
                duration     : 168,
                hp           : 620000000,
                ach          : 8000000,
                siege        : 7,
                siegeClicks  : [30, 60, 90, 120, 200, 250, 300],
                siegeDam     : [22250000, 27500000, 32500000, 37500000, 42500000, 47500000, 55000000],
                siege_img    : [
                    '/graphics/water_siege_small',
                    '/graphics/alpha_bahamut_siege_blizzard_2',
                    '/graphics/azriel_siege_inferno_2'
                ],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 30,  60],
                mClass       : 'Epic World',
                mpool        : 3,
                newbg_img    : ['monster_header_alphabahamut.jpg'],
                list_img     : ['nm_volcanic_list_2.jpg'],
                cta_img      : ['ntwitter_volcanic5.gif']
            },
            // http://castleage.wikia.com/wiki/Azriel,_the_Angel_of_Wrath
            'Azriel, The Angel Of Wrath' : {
                alpha        : true,
                duration     : 168,
                hp           : 600000000,
                ach          : 8000000,
                siege        : 7,
                siegeClicks  : [30, 60, 90, 120, 200, 250, 300],
                siegeDam     : [22250000, 27500000, 32500000, 37500000, 42500000, 47500000, 55000000],
                siege_img    : [
                    '/graphics/water_siege_small',
                    '/graphics/alpha_bahamut_siege_blizzard_2',
                    '/graphics/azriel_siege_inferno_2'
                ],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 30,  45],
                mClass       : 'Epic Boss',
                mpool        : 1,
                festival_img : ['festival_monsters_top_boss_azriel.jpg'],
                festival_dur : 192,
                festival_ach : 4000000,
                newbg_img    : ['monster_header_azriel.jpg'],
                list_img     : ['nm_azriel_list.jpg'],
                cta_img      : ['nm_azriel_twitter_1.gif']
            },
            'Alpha Mephistopheles' : {
                alpha        : true,
                duration     : 168,
                hp           : 600000000,
                ach          : 12000000,
                siege        : 10,
                siegeClicks  : [15, 30, 45, 60, 75, 100, 150, 200, 250, 300],
                siegeDam     : [19050000, 22860000, 26670000, 30480000, 34290000, 38100000, 45720000, 49530000, 53340000, 60960000],
                siege_img    : [
                    '/graphics/earth_siege_small',
                    '/graphics/castle_siege_small',
                    '/graphics/death_siege_small',
                    '/graphics/skaar_siege_small'
                ],
                fort           : true,
                staUse         : 5,
                staLvl         : [0, 100, 200, 500],
                staMax         : [5, 10, 20, 50],
                nrgMax         : [10, 20, 40, 100],
                defense_img    : 'nm_green.jpg',
                levels         : [1,  50, 100, 150],
                join           : [30, 30, 30,  45],
                mClass         : 'Epic Boss',
                mpool          : 3,
                festival_img   : ['festival_monsters_top_alpha_mephistopheles.jpg'],
                festival_dur   : 192,
                festival_ach   : 1000000,
                festival_mpool : 1,
                newbg_img      : ['monster_header_alphameph.jpg'],
                list_img       : ['nm_alpha_mephistopheles_list.jpg'],
                cta_img        : ['nm_alpha_mephistopheles_twitter_1.gif']
            },
            'Gehenna, The Fire Elemental' : {
                alpha        : true,
                duration     : 168,
                hp           : 350000000,
                ach          : 1000000,
                siege        : 7,
                siegeClicks  : [30, 60, 90, 120, 200, 250, 300],
                siegeDam     : [14750000, 18500000, 21000000, 24250000, 27000000, 30000000, 35000000],
                siege_img    : [
                    '/graphics/water_siege_small',
                    '/graphics/alpha_bahamut_siege_blizzard_2',
                    '/graphics/azriel_siege_inferno_2',
                    '/graphics/war_siege_holy_smite_2'
                ],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 30,  45],
                mClass       : 'Epic World',
                mpool        : 3,
                festival_img : ['festival_monsters_top_fire_element.jpg'],
                festival_dur : 96,
                festival_ach : 3500000,
                newbg_img    : ['monster_header_gehenna.jpg'],
                list_img     : ['nm_gehenna_list.jpg'],
                cta_img      : ['nm_gehenna_twitter_1.gif']
            },
            "Aurelius, Lion's Rebellion" : {
                alpha        : true,
                tactics      : true,
                duration     : 168,
                hp           : 350000000,
                ach          : 1000,
                siege        : 7,
                siegeClicks  : [30, 60, 90, 120, 200, 250, 300],
                siegeDam     : [15250000, 19000000, 21500000, 24750000, 27500000, 30500000, 35500000],
                siege_img    : [
                    '/graphics/water_siege_small',
                    '/graphics/alpha_bahamut_siege_blizzard_2',
                    '/graphics/azriel_siege_inferno_2',
                    '/graphics/war_siege_holy_smite_2'
                ],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 30,  45],
                mClass       : 'Epic Boss',
                mpool        : 1,
                newbg_img    : ['monster_header_lionrebellion.jpg'],
                list_img     : ['nm_aurelius_list.jpg'],
                cta_img      : ['twitter_aurelius.gif']
            },
            "Corvintheus" : {
                alpha        : true,
                duration     : 168,
                hp           : 640000000,
                ach          : 1000000,
                siege        : 10,
                siegeClicks  : [15, 30, 45, 60, 75, 100, 150, 200, 250, 300],
                siegeDam     : [16000000, 19200000, 22400000, 25600000, 28800000, 32000000, 38400000, 41600000, 44800000, 51200000],
                siege_img    : [
                    '/graphics/earth_siege_small',
                    '/graphics/castle_siege_small',
                    '/graphics/skaar_siege_small',
                    '/graphics/death_siege_small'
                ],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 30,  45],
                mClass       : 'Epic Boss',
                mpool        : 1,
                newbg_img    : ['monster_header_corvintheus.jpg'],
                list_img     : ['corv_list.jpg'],
                cta_img      : ['cta_corv1.gif']
            },
            'Valhalla, The Air Elemental' : {
                alpha        : true,
                duration     : 168,
                hp           : 650000000,
                ach          : 1000000,
                siege        : 10,
                siegeClicks  : [15, 30, 45, 60, 75, 100, 150, 200, 250, 300],
                siegeDam     : [16250000, 19500000, 22750000, 26000000, 29250000, 32500000, 39000000, 42250000, 45500000, 52000000],
                siege_img    : [
                    '/graphics/water_siege_small',
                    '/graphics/castle_siege_small',
                    '/graphics/alpha_bahamut_siege_blizzard_2',
                    '/graphics/azriel_siege_inferno_2',
                    '/graphics/war_siege_holy_smite_2'
                ],
                fort         : true,
                staUse       : 10,
                staLvl       : [0,  50, 100, 200],
                staMax       : [10, 20, 50,  100],
                nrgMax       : [20, 40, 100, 200],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 30,  45],
                mClass       : 'Epic World',
                mpool        : 3,
                festival_img : ['festival_monsters_top_air_element.jpg'],
                festival_dur : 192,
                festival_ach : 2500000,
                newbg_img    : ['monster_header_valhalla.jpg'],
                list_img     : ['monster_valhalla_list.jpg'],
                cta_img      : ['cta_valhalla.gif']
            },
            'Jahanna, Priestess Of Aurora' : {
                alpha        : true,
                duration     : 168,
                hp           : 650000000,
                ach          : 1000000,
                siege        : 10,
                siegeClicks  : [15, 30, 45, 60, 75, 100, 150, 200, 250, 300],
                siegeDam     : [16000000, 19200000, 22400000, 25600000, 28800000, 32000000, 38400000, 41600000, 44800000, 51200000],
                siege_img    : [
                    '/graphics/earth_siege_small',
                    '/graphics/castle_siege_small',
                    '/graphics/death_siege_small',
                    '/graphics/war_siege_holy_smite_2'
                ],
                fort         : true,
                staUse       : 10,
                staLvl       : [0,  50, 100, 200],
                staMax       : [10, 20, 50,  100],
                nrgMax       : [20, 40, 100, 200],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 35,  50],
                mClass       : 'Epic Boss',
                mpool        : 1,
                newbg_img    : ['monster_header_jahanna.jpg'],
                list_img     : ['boss_jahanna_list.jpg'],
                cta_img      : ['cta_jahanna.gif']
            },
            "Agamemnon The Overseer" : {
                alpha        : true,
                duration     : 168,
                hp           : 640000000,
                ach          : 1000000,
                siege        : 10,
                siegeClicks  : [15, 30, 45, 60, 75, 100, 150, 200, 250, 300],
                siegeDam     : [16000000, 19200000, 22400000, 25600000, 28800000, 32000000, 38400000, 41600000, 44800000, 51200000],
                siege_img    : [
                    '/graphics/earth_siege_small',
                    '/graphics/castle_siege_small',
                    '/graphics/skaar_siege_small',
                    '/graphics/death_siege_small'
                ],
                fort         : true,
                staUse       : 10,
                staLvl       : [0, 100, 200, 500],
                staMax       : [10, 20, 50,  100],
                nrgMax       : [20, 40, 100, 200],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 35,  50],
                mClass       : 'Epic Boss',
                mpool        : 1,
                festival_img : ['festival_monsters_top_agamemnon.jpg'],
                festival_dur : 192,
                festival_ach : 10000000,
                cta_img      : ['cta_agamemnon.gif']
            },
            "Aurora" : {
                alpha        : true,
                duration     : 168,
                hp           : 640000000,
                ach          : 1000000,
                siege        : 10,
                siegeClicks  : [15, 30, 45, 60, 75, 100, 150, 200, 250, 300],
                siegeDam     : [16000000, 19200000, 22400000, 25600000, 28800000, 32000000, 38400000, 41600000, 44800000, 51200000],
                siege_img    : [
                    '/graphics/earth_siege_small',
                    '/graphics/castle_siege_small',
                    '/graphics/skaar_siege_small',
                    '/graphics/death_siege_small'
                ],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 35,  50],
                mClass       : 'Epic Boss',
                mpool        : 1,
                newbg_img    : ['monster_header_aurora.jpg'],
                list_img     : ['boss_aurora_list.jpg'],
                cta_img      : ['cta_aurora.gif']
            },
            "Kromash, The Storm Giant" : {
                alpha        : true,
                duration     : 168,
                hp           : 500000000,
                ach          : 1000000,
                siege        : 8,
                siegeClicks  : [15, 30, 45, 60, 75, 100, 150, 200],
                siegeDam     : [10000000, 14000000, 18000000, 22000000, 26000000, 30000000, 38000000, 42000000],
                siege_img    : [
                    '/graphics/earth_siege_small',
                    '/graphics/castle_siege_small',
                    '/graphics/skaar_siege_small',
                    '/graphics/death_siege_small'
                ],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 35,  50],
                mClass       : 'Epic Boss',
                mpool        : 1,
                newbg_img    : ['monster_header_kromash.jpg'],
                list_img     : ['monster_kromash_list.jpg'],
                cta_img      : ['cta_kromash.gif']
            },
            "Glacius, The Frost Giant" : {
                alpha        : true,
                duration     : 168,
                hp           : 500000000,
                ach          : 1000000,
                siege        : 8,
                siegeClicks  : [15, 30, 45, 60, 75, 100, 150, 200],
                siegeDam     : [10000000, 14000000, 18000000, 22000000, 26000000, 30000000, 38000000, 42000000],
                siege_img    : [
                    '/graphics/earth_siege_small',
                    '/graphics/castle_siege_small',
                    '/graphics/skaar_siege_small',
                    '/graphics/death_siege_small'
                ],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 35,  50],
                mClass       : 'Epic Boss',
                mpool        : 1,
                newbg_img    : ['monster_header_glacius.jpg'],
                list_img     : ['monster_glacius_list.jpg'],
                cta_img      : ['cta_glacius.gif']
            },
            "Shardros, The Mountain Giant" : {
                alpha        : true,
                duration     : 168,
                hp           : 500000000,
                ach          : 1000000,
                siege        : 8,
                siegeClicks  : [15, 30, 45, 60, 75, 100, 150, 200],
                siegeDam     : [10000000, 14000000, 18000000, 22000000, 26000000, 30000000, 38000000, 42000000],
                siege_img    : [
                    '/graphics/earth_siege_small',
                    '/graphics/castle_siege_small',
                    '/graphics/skaar_siege_small',
                    '/graphics/death_siege_small'
                ],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 35,  50],
                mClass       : 'Epic Boss',
                mpool        : 1,
                newbg_img    : ['monster_header_shardros.jpg'],
                list_img     : ['monster_shardros_list.jpg'],
                cta_img      : ['cta_shardros.gif']
            },
            "Magmos, The Lava Giant" : {
                alpha        : true,
                duration     : 168,
                hp           : 500000000,
                ach          : 1000000,
                siege        : 8,
                siegeClicks  : [15, 30, 45, 60, 75, 100, 150, 200],
                siegeDam     : [10000000, 14000000, 18000000, 22000000, 26000000, 30000000, 38000000, 42000000],
                siege_img    : [
                    '/graphics/earth_siege_small',
                    '/graphics/castle_siege_small',
                    '/graphics/skaar_siege_small',
                    '/graphics/death_siege_small'
                ],
                fort         : true,
                staUse       : 5,
                staLvl       : [0, 100, 200, 500],
                staMax       : [5, 10, 20, 50],
                nrgMax       : [10, 20, 40, 100],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 35,  50],
                mClass       : 'Epic Boss',
                mpool        : 1,
                newbg_img    : ['monster_header_magmos.jpg'],
                list_img     : ['monster_magmos_list.jpg'],
                cta_img      : ['cta_magmos.gif']
            }
        },

        list: function () {
            try {
                var i    = '',
                    list = [];

                for (i in monster.info) {
                    if (monster.info.hasOwnProperty(i)) {
                        list.push(i);
                    }
                }

                return list.sort();
            } catch (err) {
                $u.error("ERROR in monster.list: " + err);
                return undefined;
            }
        },

        getFestName: function (img) {
            return monster.which(img, "festival_img");
        },

        getNewName: function (img) {
            return monster.which(img, "newbg_img");
        },

        getListName: function (img) {
            return monster.which(img, "list_img");
        },

        getCtaName: function (img) {
            return monster.which(img, "cta_img");
        },

        which: function (img, entity) {
            try {
                if (!$u.hasContent(img) || !$u.isString(img)) {
                    $u.warn("img", img);
                    throw "Invalid identifying img!";
                }

                if (!$u.hasContent(entity) || !$u.isString(entity)) {
                    $u.warn("entity", entity);
                    throw "Invalid entity name!";
                }

                var i    = '',
                    k    = 0,
                    r    = {},
                    name = '';

                for (i in monster.info) {
                    if (monster.info.hasOwnProperty(i)) {
                        if ($u.hasContent(name)) {
                            break;
                        }

                        r = monster.info[i];
                        if (!$u.hasContent(r) || !$u.hasContent(r[entity]) || !$j.isArray(r[entity])) {
                            continue;
                        }

                        for (k = 0; k < r[entity].length; k += 1) {
                            if (img === r[entity][k]) {
                                name = i;
                                break;
                            }
                        }
                    }
                }

                return name;
            } catch (err) {
                $u.error("ERROR in monster.which: " + err);
                return undefined;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        getInfo: function (record) {
            try {
                if (!$u.hasContent(record) || !$j.isPlainObject(record)) {
                    throw "Not passed a record";
                }

                var monsterInfo = monster.info[record['monster']];
                return $u.hasContent(record['type']) ? (record['type'] === "Raid II" ? monsterInfo.stage2 : monsterInfo.stage1) : monsterInfo;
            } catch (err) {
                $u.error("ERROR in monster.getInfo: " + err);
                return undefined;
            }
        },
        /*jslint sub: false */

        load: function () {
            try {
                monster.records = gm.getItem('monster.records', 'default');
                if (monster.records === 'default' || !$j.isArray(monster.records)) {
                    monster.records = gm.setItem('monster.records', []);
                }

                state.setItem("MonsterDashUpdate", true);
                $u.log(5, "monster.load", monster.records);
                return true;
            } catch (err) {
                $u.error("ERROR in monster.load: " + err);
                return false;
            }
        },

        save: function () {
            try {
                gm.setItem('monster.records', monster.records);
                state.setItem("MonsterDashUpdate", true);
                $u.log(5, "monster.save", monster.records);
                return true;
            } catch (err) {
                $u.error("ERROR in monster.save: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        clean: function () {
            try {
                var it   = 0,
                    list = [];

                for (it = 0; it < monster.records.length; it += 1) {
                    if (!monster.records[it]['joined']) {
                        list.push(monster.records[it]['md5']);
                    }
                }

                for (it = 0; it < list.length; it += 1) {
                    monster.deleteItem(list[it]);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in monster.clean: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        parseCondition: function (type, conditions) {
            try {
                if (!$u.hasContent(type) || !$u.hasContent(conditions) || !conditions.toLowerCase().hasIndexOf(':' + type)) {
                    return false;
                }

                var str    = $u.setContent(conditions.substring(conditions.indexOf(':' + type) + type.length + 1).replace(new RegExp(":.+"), ''), ''),
                    value  = str.numberOnly(),
                    first  = false,
                    second = false;

                if (str && (/k$/i.test(str) || /m$/i.test(str))) {
                    first = /\d+k/i.test(str);
                    second = /\d+m/i.test(str);
                    value = value * 1000 * (first + second * 1000);
                }

                return value;
            } catch (err) {
                $u.error("ERROR in monster.parseCondition: " + err);
                return false;
            }
        },

        type: function (name) {
            try {
                var words = [],
                    count = 0;

                if (!$u.isString(name)) {
                    $u.warn("name", name);
                    throw "Invalid identifying name!";
                }

                if (name === '') {
                    return '';
                }

                words = name.split(" ");
                $u.log(3, "Words", words);
                count = words.length - 1;
                if (count >= 4) {
                    if (words[count - 4] === 'Alpha' && words[count - 1] === 'Volcanic' && words[count] === 'Dragon') {
                        return words[count - 4] + ' ' + words[count - 1] + ' ' + words[count];
                    } else if (words[count - 2] === 'Priestess' && words[count - 1] === 'of' && words[count] === 'Aurora') {
                        return words[count - 2] + ' ' + words[count - 1] + ' ' + words[count];
                    }
                }

                if (words[count] === 'Elemental' || words[count] === 'Dragon' ||
                        (words[count - 1] === 'Alpha' && words[count] === 'Mephistopheles') ||
                        (words[count - 1] === "Lion's" && words[count] === 'Rebellion') ||
                        (words[count - 1] === 'Fire' && words[count] === 'Elemental')) {
                    return words[count - 1] + ' ' + words[count];
                }

                return words[count];
            } catch (err) {
                $u.error("ERROR in monster.type: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        getItem: function (md5) {
            try {
                var it        = 0,
                    len       = 0,
                    success   = false,
                    newRecord = {},
                    record    = {};

                if (!$u.isString(md5)) {
                    $u.warn("md5", md5);
                    throw "Invalid identifying md5!";
                }

                if ($u.hasContent(md5)) {
                    for (it = 0, len = monster.records.length; it < len; it += 1) {
                        if (monster.records[it]['md5'] === md5) {
                            success = true;
                            break;
                        }
                    }
                }

                if (success) {
                    record = monster.records[it];
                    $u.log(3, "Got monster record", md5, record);
                } else {
                    newRecord = new monster.record();
                    newRecord.data['md5'] = md5;
                    record = newRecord.data;
                    $u.log(3, "New monster record", md5, record);
                }

                return record;
            } catch (err) {
                $u.error("ERROR in monster.getItem: " + err);
                return undefined;
            }
        },

        setItem: function (record) {
            try {
                if (!$u.hasContent(record) || !$j.isPlainObject(record)) {
                    throw "Not passed a record";
                }

                if (!$u.isString(record['md5']) || !$u.hasContent(record['md5'])) {
                    $u.warn("md5", record['md5']);
                    throw "Invalid identifying md5!";
                }

                var it      = 0,
                    len     = 0,
                    success = false;

                if (config.getItem('enableMonsterFinder', false) && !record['select']) {
                    feed.checked(record);
                }

                record['select'] = false;
                if (record['save']) {
                    for (it = 0, len = monster.records.length; it < len; it += 1) {
                        if (monster.records[it]['md5'] === record['md5']) {
                            success = true;
                            break;
                        }
                    }

                    if (success) {
                        monster.records[it] = record;
                        $u.log(3, "Updated monster record", record, monster.records);
                    } else {
                        monster.records.push(record);
                        $u.log(3, "Added monster record", record, monster.records);
                    }

                    monster.save();
                }

                return record;
            } catch (err) {
                $u.error("ERROR in monster.setItem: " + err);
                return undefined;
            }
        },

        deleteItem: function (md5) {
            try {
                var it        = 0,
                    len       = 0,
                    success   = false;

                if (!$u.isString(md5) || !$u.hasContent(md5)) {
                    $u.warn("md5", md5);
                    throw "Invalid identifying md5!";
                }

                for (it = 0, len = monster.records.length; it < len; it += 1) {
                    if (monster.records[it]['md5'] === md5) {
                        success = true;
                        break;
                    }
                }

                if (success) {
                    monster.records.splice(it, 1);
                    monster.save();
                    $u.log(3, "Deleted monster record", md5, monster.records);
                } else {
                    $u.warn("Unable to delete monster record", md5, monster.records);
                }

                return success;
            } catch (err) {
                $u.error("ERROR in monster.deleteItem: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        clear: function () {
            try {
                monster.records = gm.setItem("monster.records", []);
                state.setItem("MonsterDashUpdate", true);
                return true;
            } catch (err) {
                $u.error("ERROR in monster.clear: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        t2kCalc: function (record) {
            try {
                var boss                           = monster.getInfo(record),
                    siegeStage                     = record['phase'] - 1,
                    timeLeft                       = record['time'][0] + (record['time'][1] * 0.0166),
                    duration                       = record['page'] === 'festival_battle_monster' ? (boss ? boss.festival_dur : 192) : (boss ? boss.duration : 192),
                    timeUsed                       = duration - timeLeft,
                    T2K                            = 0,
                    damageDone                     = 0,
                    hpLeft                         = 0,
                    totalSiegeDamage               = 0,
                    totalSiegeClicks               = 0,
                    attackDamPerHour               = 0,
                    clicksPerHour                  = 0,
                    clicksToNextSiege              = 0,
                    nextSiegeAttackPlusSiegeDamage = 0,
                    s                              = 0,
                    len                            = 0,
                    siegeImpacts                   = 0;

                if (!boss.siege || !boss.hp) {
                    T2K = ((record['life'] * timeUsed) / (100 - record['life'])).dp(2);
                    $u.log(3, 'T2K: ', $u.minutes2hours(T2K));
                    return T2K;
                }

                damageDone = (100 - record['life']) / 100 * boss.hp;
                hpLeft = boss.hp - damageDone;
                for (s = 0, len = boss.siegeClicks.length; s < len; s += 1) {
                    $u.log(5, 's ', s, ' T2K ', T2K, ' hpLeft ', hpLeft);
                    if (s < siegeStage || record['miss'] === 0) {
                        totalSiegeDamage += boss.siegeDam[s];
                        totalSiegeClicks += boss.siegeClicks[s];
                    } else if (s === siegeStage) {
                        attackDamPerHour = (damageDone - totalSiegeDamage) / timeUsed;
                        clicksPerHour = (totalSiegeClicks + boss.siegeClicks[s] - record['miss']) / timeUsed;
                        $u.log(5, 'Attack Damage Per Hour: ', attackDamPerHour);
                        $u.log(5, 'Damage Done: ', damageDone);
                        $u.log(5, 'Total Siege Damage: ', totalSiegeDamage);
                        $u.log(5, 'Time Used: ', timeUsed);
                        $u.log(5, 'Clicks Per Hour: ', clicksPerHour);
                    } else if (s >= siegeStage) {
                        clicksToNextSiege = (s === siegeStage) ? record['miss'] : boss.siegeClicks[s];
                        nextSiegeAttackPlusSiegeDamage = boss.siegeDam[s] + clicksToNextSiege / clicksPerHour * attackDamPerHour;
                        if (hpLeft <= nextSiegeAttackPlusSiegeDamage || record['miss'] === 0) {
                            T2K += hpLeft / attackDamPerHour;
                            break;
                        }

                        T2K += clicksToNextSiege / clicksPerHour;
                        hpLeft -= nextSiegeAttackPlusSiegeDamage;
                    }
                }

                siegeImpacts = (record['life'] / (100 - record['life']) * timeLeft).dp(2);
                T2K = T2K.dp(2);
                $u.log(3, 'T2K based on siege: ', $u.minutes2hours(T2K));
                $u.log(3, 'T2K estimate without calculating siege impacts: ', $u.minutes2hours(siegeImpacts));
                return T2K > 0 ? T2K : siegeImpacts;
            } catch (err) {
                $u.error("ERROR in monster.t2kCalc: " + err);
                return 0;
            }
        },

        characterClass: {
            'Warrior' : ['Strengthen', 'Heal'],
            'Rogue'   : ['Cripple'],
            'Mage'    : ['Deflect'],
            'Cleric'  : ['Heal'],
            'Warlock' : ['Heal', 'Deflect'],
            'Ranger'  : ['Strengthen', 'Cripple']
        },
        /*jslint sub: false */

        flagReview: function (force) {
            try {
                schedule.setItem("monsterReview", 0);
                state.setItem('monsterReviewCounter', config.getItem("festivalTower", false) ? -4 : -3);
                return true;
            } catch (err) {
                $u.error("ERROR in monster.flagReview: " + err);
                return false;
            }
        },

        flagFullReview: function (force) {
            try {
                monster.clear();
                monster.flagReview();
                schedule.setItem('NotargetFrombattle_monster', 0);
                state.setItem('ReleaseControl', true);
                caap.updateDashboard(true);
                return true;
            } catch (err) {
                $u.error("ERROR in monster.flagFullReview: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        energyTarget: function () {
            this.data = {
                'md5'  : '',
                'name' : '',
                'type' : ''
            };
        },

        select: function (force) {
            try {
                if (!(force || schedule.oneMinuteUpdate('selectMonster')) || caap.stats['level'] < 7) {
                    return false;
                }

                $u.log(3, 'Selecting monster');
                var monsterList  = {
                        'battle_monster' : [],
                        'raid'           : [],
                        'any'            : []
                    },
                    it                    = 0,
                    len                   = 0,
                    len1                  = 0,
                    len2                  = 0,
                    len3                  = 0,
                    s                     = 0,
                    selectTypes           = [],
                    maxToFortify          = 0,
                    nodeNum               = 0,
                    firstOverAch          = '',
                    firstUnderMax         = '',
                    firstFortOverAch      = '',
                    firstFortUnderMax     = '',
                    firstStunOverAch      = '',
                    firstStunUnderMax     = '',
                    firstStrengthOverAch  = '',
                    firstStrengthUnderMax = '',
                    strengthTarget        = '',
                    fortifyTarget         = '',
                    stunTarget            = '',
                    energyTarget          = new monster.energyTarget(),
                    monsterMD5            = '',
                    monsterObj            = {},
                    monsterConditions     = '',
                    //monstType             = '',
                    monsterInfo           = {},
                    p                     = 0,
                    m                     = 0,
                    attackOrderList       = [],
                    theGeneral            = config.getItem('MonsterGeneral', 'Use Current');

                theGeneral = theGeneral === "Under Level" ? (config.getItem('ReverseLevelUpGenerals') ? general.GetLevelUpNames().reverse().pop() : general.GetLevelUpNames().pop()) : theGeneral;
                // First we forget everything about who we already picked.
                state.setItem('targetFrombattle_monster', '');
                state.setItem('targetFromfortify', energyTarget.data);
                state.setItem('targetFromraid', '');

                // Next we get our monster objects from the reposoitory and break them into separarte lists
                // for monster or raid.  If we are serializing then we make one list only.
                for (it = 0, len = monster.records.length; it < len; it += 1) {
                    if (!monster.records[it]['joined']) {
                        continue;
                    }

                    monsterInfo = monster.getInfo(monster.records[it]);
                    if (monsterInfo && monsterInfo.alpha) {
                        if (monster.records[it]['damage'] !== -1 && monster.records[it]['color'] !== 'grey' && schedule.since(monster.records[it]['stunTime'], 0)) {
                            $u.log(2, "Review monster due to class timer", monster.records[it]['name']);
                            monster.records[it]['review'] = -1;
                            monster.flagReview();
                        }
                    }

                    monster.records[it]['conditions'] = 'none';
                    if (config.getItem('SerializeRaidsAndMonsters', false)) {
                        monsterList['any'].push(monster.records[it]['md5']);
                    } else if ((monster.records[it]['page'] === 'raid') || (monster.records[it]['page'].replace('festival_battle_monster', 'battle_monster') === 'battle_monster')) {
                        monsterList[monster.records[it]['page'].replace('festival_battle_monster', 'battle_monster')].push(monster.records[it]['md5']);
                    }
                }

                monster.save();

                //PLEASE NOTE BEFORE CHANGING
                //The Serialize Raids and Monsters dictates a 'single-pass' because we only need select
                //one "targetFromxxxx" to fill in. The other MUST be left blank. This is what keeps it
                //serialized!!! Trying to make this two pass logic is like trying to fit a square peg in
                //a round hole. Please reconsider before doing so.
                if (config.getItem('SerializeRaidsAndMonsters', false)) {
                    selectTypes = ['any'];
                } else {
                    selectTypes = ['battle_monster', 'raid'];
                }

                $u.log(3, 'records/monsterList/selectTypes', monster.records, monsterList, selectTypes);
                // We loop through for each selection type (only once if serialized between the two)
                // We then read in the users attack order list
                for (s = 0, len1 = selectTypes.length; s < len1; s += 1) {
                    if (!$u.hasContent(monsterList[selectTypes[s]])) {
                        continue;
                    }

                    firstOverAch          = '';
                    firstUnderMax         = '';
                    firstFortOverAch      = '';
                    firstFortUnderMax     = '';
                    firstStunOverAch      = '';
                    firstStunUnderMax     = '';
                    firstStrengthOverAch  = '';
                    firstStrengthUnderMax = '';
                    strengthTarget        = '';
                    fortifyTarget         = '';
                    stunTarget            = '';
                    energyTarget          = new monster.energyTarget();

                    // The extra apostrophe at the end of attack order makes it match any "soandos's monster" so it always selects a monster if available
                    if (selectTypes[s] === 'any') {
                        attackOrderList = config.getList('orderbattle_monster', '');
                        $j.merge(attackOrderList, config.getList('orderraid', '').concat('your', "'"));
                    } else {
                        attackOrderList = config.getList('order' + selectTypes[s], '').concat('your', "'");
                    }

                    $u.log(3, 'attackOrderList', attackOrderList);
                    // Next we step through the users list getting the name and conditions
                    for (p = 0, len2 = attackOrderList.length; p < len2; p += 1) {
                        if (!attackOrderList[p].trim()) {
                            continue;
                        }

                        monsterConditions = attackOrderList[p].replace(new RegExp("^[^:]+"), '').toString().trim();
                        // Now we try to match the users name agains our list of monsters
                        for (m = 0, len3 = monsterList[selectTypes[s]].length; m < len3; m += 1) {
                            if (!monsterList[selectTypes[s]][m]) {
                                continue;
                            }

                            monsterObj = monster.getItem(monsterList[selectTypes[s]][m]);
                            // If we set conditions on this monster already then we do not reprocess
                            if (monsterObj['conditions'] !== 'none') {
                                continue;
                            }

                            // If this monster does not match, skip to next one
                            // Or if this monster is dead, skip to next one
                            // Or if this monster is not the correct type, skip to next one
                            if (!monster.getItem(monsterList[selectTypes[s]][m])['name'].toLowerCase().hasIndexOf(attackOrderList[p].match(new RegExp("^[^:]+")).toString().trim().toLowerCase()) || (selectTypes[s] !== 'any' && monsterObj['page'].replace('festival_battle_monster', 'battle_monster') !== selectTypes[s])) {
                                continue;
                            }

                            //Monster is a match so we set the conditions
                            monsterObj['conditions'] = monsterConditions;
                            monsterObj['select'] = true;
                            monster.setItem(monsterObj);
                            // If it's complete or collect rewards, no need to process further
                            if (monsterObj['color'] === 'grey') {
                                continue;
                            }

                            $u.log(3, 'Current monster being checked', monsterObj);
                            // checkMonsterDamage would have set our 'color' and 'over' values. We need to check
                            // these to see if this is the monster we should select
                            if (!firstUnderMax && monsterObj['color'] !== 'purple') {
                                if (monsterObj['over'] === 'ach') {
                                    if (!firstOverAch) {
                                        firstOverAch = monsterList[selectTypes[s]][m];
                                        $u.log(3, 'firstOverAch', firstOverAch, monsterObj['name']);
                                    }
                                } else if (monsterObj['over'] !== 'max') {
                                    firstUnderMax = monsterList[selectTypes[s]][m];
                                    $u.log(3, 'firstUnderMax', firstUnderMax, monsterObj['name']);
                                }
                            }

                            monsterInfo = monster.getInfo(monsterObj);
                            if (monsterInfo) {
                                if (!monsterInfo.alpha || (monsterInfo.alpha && monster.characterClass[monsterObj['charClass']] && monster.characterClass[monsterObj['charClass']].hasIndexOf('Heal'))) {
                                    maxToFortify = (monster.parseCondition('f%', monsterConditions) !== false) ? monster.parseCondition('f%', monsterConditions) : config.getItem('MaxToFortify', 0);
                                    if (monsterInfo.fort && !firstFortUnderMax && monsterObj['fortify'] < maxToFortify) {
                                        if (monsterObj['over'] === 'ach') {
                                            if (!firstFortOverAch) {
                                                firstFortOverAch = monsterList[selectTypes[s]][m];
                                                $u.log(3, 'firstFortOverAch', firstFortOverAch, monsterObj['name']);
                                            }
                                        } else if (monsterObj['over'] !== 'max') {
                                            firstFortUnderMax = monsterList[selectTypes[s]][m];
                                            $u.log(3, 'firstFortUnderMax', firstFortUnderMax, monsterObj['name']);
                                        }
                                    }
                                }

                                if (monsterInfo.alpha) {
                                    if (config.getItem("StrengthenTo100", true) && monster.characterClass[monsterObj['charClass']] && monster.characterClass[monsterObj['charClass']].hasIndexOf('Strengthen')) {
                                        if (!firstStrengthUnderMax && monsterObj['strength'] < 100) {
                                            if (monsterObj['over'] === 'ach') {
                                                if (!firstStrengthOverAch) {
                                                    firstStrengthOverAch = monsterList[selectTypes[s]][m];
                                                    $u.log(3, 'firstStrengthOverAch', firstStrengthOverAch, monsterObj['name']);
                                                }
                                            } else if (monsterObj['over'] !== 'max') {
                                                firstStrengthUnderMax = monsterList[selectTypes[s]][m];
                                                $u.log(3, 'firstStrengthUnderMax', firstStrengthUnderMax, monsterObj['name']);
                                            }
                                        }
                                    }

                                    if (!firstStunUnderMax && monsterObj['stunDo']) {
                                        if (monsterObj['over'] === 'ach') {
                                            if (!firstStunOverAch) {
                                                firstStunOverAch = monsterList[selectTypes[s]][m];
                                                $u.log(3, 'firstStunOverAch', firstStunOverAch, monsterObj['name']);
                                            }
                                        } else if (monsterObj['over'] !== 'max') {
                                            firstStunUnderMax = monsterList[selectTypes[s]][m];
                                            $u.log(3, 'firstStunUnderMax', firstStunUnderMax, monsterObj['name']);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    // Now we use the first under max/under achievement that we found. If we didn't find any under
                    // achievement then we use the first over achievement
                    if (selectTypes[s] !== 'raid') {
                        strengthTarget = firstStrengthUnderMax;
                        if (!strengthTarget) {
                            strengthTarget = firstStrengthOverAch;
                        }

                        if (strengthTarget) {
                            energyTarget.data['md5']  = strengthTarget;
                            energyTarget.data['name'] = monster.getItem(strengthTarget)['name'];
                            energyTarget.data['type'] = 'Strengthen';
                            $u.log(3, 'Strengthen target ', energyTarget.data['name']);
                        }

                        fortifyTarget = firstFortUnderMax;
                        if (!fortifyTarget) {
                            fortifyTarget = firstFortOverAch;
                        }

                        if (fortifyTarget) {
                            energyTarget.data['md5']  = fortifyTarget;
                            energyTarget.data['name'] = monster.getItem(fortifyTarget)['name'];
                            energyTarget.data['type'] = 'Fortify';
                            $u.log(3, 'Fortify replaces strengthen ', energyTarget.data['name']);
                        }

                        stunTarget = firstStunUnderMax;
                        if (!stunTarget) {
                            stunTarget = firstStunOverAch;
                        }

                        if (stunTarget) {
                            energyTarget.data['md5']  = stunTarget;
                            energyTarget.data['name'] = monster.getItem(stunTarget)['name'];
                            energyTarget.data['type'] = 'Stun';
                            $u.log(3, 'Stun target replaces fortify ', energyTarget.data['name']);
                        }

                        state.setItem('targetFromfortify', energyTarget.data);
                        if (energyTarget.data['name']) {
                            $u.log(3, 'Energy target', energyTarget.data);
                        }
                    }

                    monsterMD5 = firstUnderMax;
                    if (!monsterMD5) {
                        monsterMD5 = firstOverAch;
                    }

                    // If we've got a monster for this selection type then we set the GM variables for the name
                    // and stamina requirements
                    if (monsterMD5) {
                        monsterObj = monster.getItem(monsterMD5);
                        monsterInfo = monster.getInfo(monsterObj);
                        state.setItem('targetFrom' + monsterObj['page'].replace('festival_battle_monster', 'battle_monster'), monsterMD5);
                        if (monsterObj['page'].replace('festival_battle_monster', 'battle_monster') === 'battle_monster') {
                            nodeNum = 0;
                            if (!caap.inLevelUpMode() && monsterInfo && monsterInfo.staLvl) {
                                for (nodeNum = monsterInfo.staLvl.length - 1; nodeNum >= 0; nodeNum -= 1) {
                                    if (caap.stats['stamina']['max'] >= monsterInfo.staLvl[nodeNum]) {
                                        break;
                                    }
                                }
                            }

                            if (!caap.inLevelUpMode() && monsterInfo && monsterInfo.staMax && config.getItem('PowerAttack', false) && config.getItem('PowerAttackMax', false)) {
                                if (monsterInfo.attack_img) {
                                    nodeNum = 1;
                                }

                                state.setItem('MonsterStaminaReq', monsterInfo.staMax[nodeNum]);
                            } else if (monsterInfo && monsterInfo.staUse) {
                                state.setItem('MonsterStaminaReq', monsterInfo.staUse);
                            } else if ((caap.inLevelUpMode() && caap.stats['stamina']['num'] >= 10) || /:pa/i.test(monsterObj['conditions'])) {
                                state.setItem('MonsterStaminaReq', 5);
                            } else if (/:sa/i.test(monsterObj['conditions'])) {
                                state.setItem('MonsterStaminaReq', 1);
                            } else if ((caap.inLevelUpMode() && caap.stats['stamina']['num'] >= 10) || config.getItem('PowerAttack', true)) {
                                state.setItem('MonsterStaminaReq', 5);
                            } else {
                                state.setItem('MonsterStaminaReq', 1);
                            }

                            switch (theGeneral) {
                            case 'Orc King':
                                state.setItem('MonsterStaminaReq', state.getItem('MonsterStaminaReq', 1) * (general.GetLevel('Orc King') + 1));
                                $u.log(3, 'MonsterStaminaReq:Orc King', state.getItem('MonsterStaminaReq', 1));
                                break;
                            case 'Barbarus':
                                state.setItem('MonsterStaminaReq', state.getItem('MonsterStaminaReq', 1) * (general.GetLevel('Barbarus') === 4 ? 3 : 2));
                                $u.log(3, 'MonsterStaminaReq:Barbarus', state.getItem('MonsterStaminaReq', 1));
                                break;
                            case 'Maalvus':
                                state.setItem('MonsterStaminaReq', state.getItem('MonsterStaminaReq', 1) * (general.GetLevel('Maalvus') >= 3 ? 3 : 2));
                                $u.log(3, 'MonsterStaminaReq:Maalvus', state.getItem('MonsterStaminaReq', 1));
                                break;
                            default:
                            }
                        } else {
                            if (config.getItem('RaidPowerAttack', false) || /:pa/i.test(monsterObj['conditions'])) {
                                state.setItem('RaidStaminaReq', 5);
                            } else if (monsterInfo && monsterInfo.staUse) {
                                state.setItem('RaidStaminaReq', monsterInfo.staUse);
                            } else {
                                state.setItem('RaidStaminaReq', 1);
                            }
                        }
                    }
                }

                caap.updateDashboard(true);
                return true;
            } catch (err) {
                $u.error("ERROR in monster.select: " + err);
                return false;
            }
        },

        confirmRightPage: function (monsterName) {
            try {
                // Confirm name and type of monster
                var monsterDiv  = $j("div[style*='dragon_title_owner'],div[style*='monster_header_']" + (config.getItem("festivalTower", false) ? ",div[style*='festival_monsters_top_']" : ""), caap.appBodyDiv),
                    tempDiv     = $j(),
                    tempText    = '',
                    fMonstStyle = '',
                    nMonstStyle = '',
                    feedMonster = '',
                    userName    = '',
                    mName       = '',
                    id          = 0,
                    md5         = '',
                    //page        = state.getItem('page', 'battle_monster');
                    page         = $j(".game", caap.globalContainer).eq(0).attr("id").replace(caap.domain.id[caap.domain.which], '');

                if ($u.hasContent(monsterDiv)) {
                    fMonstStyle = monsterDiv.attr("style").regex(/(festival_monsters_top_\S+\.jpg)/);
                    $u.log(2, "confirmRightPage fMonstStyle", fMonstStyle);
                    if ($u.hasContent(fMonstStyle)) {
                        tempText = $u.setContent(monsterDiv.children(":eq(3)").text(), '').trim().innerTrim().replace(/summoned/i, monster.getFestName(fMonstStyle));
                    } else {
                        nMonstStyle = monsterDiv.attr("style").regex(/(monster_header_\S+\.jpg)/);
                        $u.log(2, "confirmRightPage nMonstStyle", nMonstStyle);
                        if ($u.hasContent(nMonstStyle)) {
                            tempText = $u.setContent(monsterDiv.children(":eq(1)").children(":eq(1)").text(), '').trim().innerTrim().replace(/ summoned/i, "'s " + monster.getNewName(nMonstStyle));
                        } else {
                            tempText = $u.setContent(monsterDiv.children(":eq(2)").text(), '').trim().innerTrim();
                        }
                    }

                    $u.log(2, "confirmRightPage tempText", tempText);
                } else {
                    monsterDiv = $j("div[style*='nm_top']", caap.appBodyDiv);
                    if ($u.hasContent(monsterDiv)) {
                        tempText = $u.setContent(monsterDiv.children(":eq(0)").children(":eq(0)").text(), '').trim().innerTrim();
                        tempDiv = $j("div[style*='nm_bars']", caap.appBodyDiv);
                        if ($u.hasContent(tempDiv)) {
                            tempText += ' ' + $u.setContent(tempDiv.children(":eq(0)").children(":eq(0)").children(":eq(0)").siblings(":last").children(":eq(0)").text(), '').trim().replace("'s Life", "");
                        } else {
                            $u.warn("Problem finding nm_bars");
                            return false;
                        }
                    } else {
                        if ($u.hasContent(fMonstStyle)) {
                            $j().alert(fMonstStyle + "<br />I don't know this monster!<br />Please inform me.");
                        }

                        if ($u.hasContent($j("div[style*='no_monster_back.jpg']", caap.appBodyDiv))) {
                            $u.log(2, "No monster");
                        }  else {
                            $u.warn("Problem finding dragon_title_owner and nm_top");
                        }

                        return false;
                    }
                }

                if ($u.hasContent(monsterDiv)) {
                    id = $u.setContent($j("img[src*='profile.ak.fbcdn.net']", monsterDiv).attr("uid"), '').regex(/(\d+)/);
                    id = $u.setContent(id, $u.setContent($j(".fb_link[href*='profile.php']", monsterDiv).attr("href"), '').regex(/id=(\d+)/));
                    id = $u.setContent(id, $u.setContent($j("img[src*='graph.facebook.com']", monsterDiv).attr("src"), '').regex(/\/(\d+)\//));
                    id = $u.setContent(id, $u.setContent($j("button[onclick*='ajaxSectionUpdate']", caap.appBodyDiv).attr("onclick") + "", '').regex(/user=(\d+)/));
                    id = $u.setContent(id, 0);
                    if (id === 0 || !$u.hasContent(id)) {
                        $u.warn("Unable to get id!");
                        return false;
                    }

                    if (/Aurelius, Lion's Rebellion/.test(tempText)) {
                        feedMonster = "Aurelius, Lion's Rebellion";
                        userName = tempText.replace(feedMonster, '').trim();
                    } else {
                        feedMonster = tempText.replace(new RegExp(".+'s (.+)$"), '$1');
                        userName = tempText.replace(feedMonster, '').trim();
                        feedMonster = feedMonster.trim().innerTrim().toLowerCase().ucWords();
                    }

                    if (!$u.hasContent(feedMonster)) {
                        $u.warn("Unable to get monster string!!");
                        return false;
                    }

                    if (id === caap.stats['FBID']) {
                        $u.log(2, "Your monster found", tempText);
                        userName = 'Your';
                    }
                } else {
                    $u.warn("monster.confirmRightPage monsterDiv issue!");
                    return false;
                }

                mName = userName + ' ' + feedMonster;
                $u.log(2, 'monster Name', mName);
                if (monsterName !== mName) {
                    $u.log(2, 'Looking for ' + monsterName + ' but on ' + mName + '. Going back to select screen');
                    page = page === 'onMonster' ? 'battle_monster' : (page === 'onRaid' ? 'raid' : page);
                    $u.log(4, "monster.confirmRightPage page", page);
                    return caap.navigateTo('keep,' + monster.getItem(md5 = (id + ' ' + feedMonster + ' ' + page).toLowerCase().MD5()).page);
                }

                return false;
            } catch (err) {
                $u.error("ERROR in monster.confirmRightPage: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        menu: function () {
            try {
                var XMonsterInstructions = "Start attacking if stamina is above this points",
                    XMinMonsterInstructions = "Don not attack if stamina is below this points",
                    attackOrderInstructions = "List of search words that decide which monster to attack first. " +
                        "Use words in player name or in monster name. To specify max damage follow keyword with " +
                        ":max token and specifiy max damage values. Use 'k' and 'm' suffixes for thousand and million. " +
                        "To override achievement use the ach: token and specify damage values.",
                    fortifyInstructions = "Fortify if ship health is below this % (leave blank to disable)",
                    questFortifyInstructions = "Do quests if ship health is above this % and quest mode is set to Not Fortify (leave blank to disable)",
                    stopAttackInstructions = "Do not attack if ship health is below this % (leave blank to disable)",
                    monsterachieveInstructions = "Check if monsters have reached achievement damage level first. Switch when achievement met.",
                    demiPointsFirstInstructions = "Don't attack monsters until you've gotten all your demi points from battling. Set 'Battle When' to 'No Monster' or 'Demi Points Only'. Be sure to set battle to Invade or Duel, War does not give you Demi Points.",
                    powerattackInstructions = "Use power attacks. Only do normal attacks if power attack not possible",
                    powerattackMaxInstructions = "Use maximum power attacks globally on Skaar, Genesis, Ragnarok, and Bahamut types. Only do normal power attacks if maximum power attack not possible",
                    powerfortifyMaxInstructions = "Use maximum power fortify globally. Only do normal fortify attacks if maximum power fortify not possible. " +
                        "Also includes other energy attacks, Strengthen, Deflect and Cripple. NOTE: Setting a high forty% can waste energy and no safety on other types.",
                    dosiegeInstructions = "Turns on or off automatic siege assist for all monsters only.",
                    useTacticsInstructions = "Use the Tactics attack method, on monsters that support it, instead of the normal attack. You must be level 50 or above.",
                    useTacticsThresholdInstructions = "If monster health falls below this percentage then use the regular attack buttons instead of tactics.",
                    collectRewardInstructions = "Automatically collect monster rewards.",
                    strengthenTo100Instructions = "Do not wait until the character class gets a bonus for strengthening but perform strengthening as soon as the energy is available.",
                    mbattleList = [
                        'Stamina Available',
                        'At Max Stamina',
                        'At X Stamina',
                        'Stay Hidden',
                        'Never'
                    ],
                    mbattleInst = [
                        'Stamina Available will attack whenever you have enough stamina',
                        'At Max Stamina will attack when stamina is at max and will burn down all stamina when able to level up',
                        'At X Stamina you can set maximum and minimum stamina to battle',
                        'Stay Hidden uses stamina to try to keep you under 10 health so you cannot be attacked, while also attempting to maximize your stamina use for Monster attacks. YOU MUST SET BATTLE WHEN TO "STAY HIDDEN" TO USE THIS FEATURE.',
                        'Never - disables attacking monsters'
                    ],
                    monsterDelayInstructions = "Max random delay (in seconds) to battle monsters",
                    demiPtItem = 0,
                    subCode = '',
                    htmlCode = '';

                htmlCode += caap.startToggle('Monster', 'MONSTER');
                htmlCode += caap.makeDropDownTR("Attack When", 'WhenMonster', mbattleList, mbattleInst, '', 'Never', false, false, 62);
                htmlCode += caap.startDropHide('WhenMonster', '', 'Never', true);
                htmlCode += "<div id='caap_WhenMonsterStayHidden_hide' style='color: red; font-weight: bold; display: ";
                htmlCode += (config.getItem('WhenMonster', 'Never') === 'Stay Hidden' && config.getItem('WhenBattle', 'Never') !== 'Stay Hidden' ? 'block' : 'none') + "'>";
                htmlCode += "Warning: Battle Not Set To 'Stay Hidden'";
                htmlCode += "</div>";
                htmlCode += caap.startDropHide('WhenMonster', 'XStamina', 'At X Stamina', false);
                htmlCode += caap.makeNumberFormTR("Start At Or Above", 'XMonsterStamina', XMonsterInstructions, 1, '', '', true, false);
                htmlCode += caap.makeNumberFormTR("Stop At Or Below", 'XMinMonsterStamina', XMinMonsterInstructions, 0, '', '', true, false);
                htmlCode += caap.endDropHide('WhenMonster', 'XStamina', 'At X Stamina', false);
                htmlCode += caap.makeNumberFormTR("Monster delay secs", 'seedTime', monsterDelayInstructions, 300, '', '');
                htmlCode += caap.makeCheckTR("Use Tactics", 'UseTactics', false, useTacticsInstructions);
                htmlCode += caap.startCheckHide('UseTactics');
                htmlCode += caap.makeNumberFormTR("Health threshold", 'TacticsThreshold', useTacticsThresholdInstructions, 75, '', '', true, false);
                htmlCode += caap.endCheckHide('UseTactics');
                htmlCode += caap.makeCheckTR("Power Attack Only", 'PowerAttack', true, powerattackInstructions);
                htmlCode += caap.startCheckHide('PowerAttack');
                htmlCode += caap.makeCheckTR("Power Attack Max", 'PowerAttackMax', false, powerattackMaxInstructions, true);
                htmlCode += caap.endCheckHide('PowerAttack');
                htmlCode += caap.makeCheckTR("Power Fortify Max", 'PowerFortifyMax', false, powerfortifyMaxInstructions);
                htmlCode += caap.makeCheckTR("Siege Weapon Assist Monsters", 'monsterDoSiege', true, dosiegeInstructions);
                htmlCode += caap.makeCheckTR("Collect Monster Rewards", 'monsterCollectReward', false, collectRewardInstructions);
                htmlCode += caap.makeCheckTR("Clear Complete Monsters", 'clearCompleteMonsters', false, '');
                htmlCode += caap.makeCheckTR("Achievement Mode", 'AchievementMode', true, monsterachieveInstructions);
                htmlCode += caap.makeCheckTR("Get Demi Points First", 'DemiPointsFirst', false, demiPointsFirstInstructions);
                htmlCode += caap.startCheckHide('DemiPointsFirst');
                for (demiPtItem = 0; demiPtItem < caap.demiQuestList.length; demiPtItem += 1) {
                    subCode += "<span title='" + caap.demiQuestList[demiPtItem] + "'>";
                    subCode += "<img alt='" + caap.demiQuestList[demiPtItem] + "' src='data:image/gif;base64," + image64[caap.demiQuestList[demiPtItem]] + "' height='15px' width='15px'/>";
                    subCode += caap.makeCheckBox('DemiPoint' + demiPtItem, true);
                    subCode += "</span>";
                }

                htmlCode += caap.makeTD(subCode, false, false, "white-space: nowrap;");
                htmlCode += caap.endCheckHide('DemiPointsFirst');
                htmlCode += caap.makeNumberFormTR("Fortify If % Under", 'MaxToFortify', fortifyInstructions, 50, '', '');
                htmlCode += caap.makeNumberFormTR("Quest If % Over", 'MaxHealthtoQuest', questFortifyInstructions, 60, '', '');
                htmlCode += caap.makeNumberFormTR("No Attack If % Under", 'MinFortToAttack', stopAttackInstructions, 10, '', '');
                htmlCode += caap.makeCheckTR("Don't Wait Until Strengthen", 'StrengthenTo100', true, strengthenTo100Instructions);
                htmlCode += caap.makeTD("Attack Monsters in this order <a href='http://senses.ws/caap/index.php?topic=1502.0' target='_blank' style='color: blue'>(INFO)</a>");
                htmlCode += caap.makeTextBox('orderbattle_monster', attackOrderInstructions, '', '');
                htmlCode += caap.endDropHide('WhenMonster');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in monster.menu: " + err);
                return '';
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        dashboard: function () {
            try {
                if (config.getItem('DBDisplay', '') === 'Monster' && state.getItem("MonsterDashUpdate", true)) {
                    var headers                  = ['Name', 'Damage', 'Dmg%', 'Fort%', 'Str%', 'Time', 'T2K', 'Phase', '&nbsp;', '&nbsp;', '&nbsp;'],
                        values                   = ['name', 'damage', 'life', 'fortify', 'strength', 'time', 't2k', 'phase', 'link'],
                        pp                       = 0,
                        value                    = null,
                        color                    = '',
                        monsterConditions        = '',
                        achLevel                 = 0,
                        maxDamage                = 0,
                        title                    = '',
                        id                       = '',
                        monsterObjLink           = '',
                        visitMonsterLink         = '',
                        visitMonsterInstructions = '',
                        removeLink               = '',
                        removeLinkInstructions   = '',
                        len                      = 0,
                        data                     = {text: '', color: '', bgcolor: '', id: '', title: ''},
                        linkRegExp               = new RegExp("'(http.+)'"),
                        duration                 = 0,
                        count                    = 0,
                        handler                  = null,
                        monsterInfo              = {},
                        head                     = '',
                        body                     = '',
                        row                      = '';

                    for (pp = 0, len = headers.length; pp < len; pp += 1) {
                        switch (headers[pp]) {
                        case 'Name' :
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '30%'});
                            break;
                        case 'Damage' :
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '13%'});
                            break;
                        case 'Dmg%' :
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '8%'});
                            break;
                        case 'Fort%' :
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '8%'});
                            break;
                        case 'Str%' :
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '8%'});
                            break;
                        case 'Time' :
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '8%'});
                            break;
                        case 'T2K' :
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '8%'});
                            break;
                        case 'Link' :
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '2%'});
                            break;
                        case 'Phase' :
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '13%'});
                            break;
                        case '&nbsp;' :
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '1%'});
                            break;
                        default:
                        }
                    }

                    head = caap.makeTr(head);
                    values.shift();
                    monster.records.forEach(function (monsterObj) {
                        row = '';
                        monsterInfo = monster.getInfo(monsterObj);
                        color = monsterObj['color'];
                        if (monsterObj['md5'] === state.getItem('targetFromfortify', new monster.energyTarget().data)['md5']) {
                            color = 'blue';
                        } else if (monsterObj['md5'] === state.getItem('targetFrombattle_monster', '') || monsterObj['md5'] === state.getItem('targetFromraid', '')) {
                            color = 'green';
                        }

                        monsterConditions = monsterObj['conditions'];
                        achLevel = monster.parseCondition('ach', monsterConditions);
                        maxDamage = monster.parseCondition('max', monsterConditions);
                        monsterObjLink = monsterObj['link'];
                        if (monsterObjLink) {
                            visitMonsterLink = monsterObjLink.replace("&action=doObjective", "").match(linkRegExp);
                            visitMonsterInstructions = "Clicking this link will take you to " + monsterObj['name'];
                            data = {
                                text  : '<span id="caap_monster_' + count + '" title="' + visitMonsterInstructions + '" mname="' + monsterObj['name'] + '" mmd5="' + monsterObj['md5'] + '" rlink="' + visitMonsterLink[1] +
                                        '" onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';">' + monsterObj['name'] + '</span>',
                                color : 'blue',
                                id    : '',
                                title : ''
                            };

                            row += caap.makeTd(data);
                        } else {
                            row += caap.makeTd({text: monsterObj['name'], color: color, id: '', title: ''});
                        }

                        values.forEach(function (displayItem) {
                            id = "caap_" + displayItem + "_" + count;
                            title = '';
                            if (displayItem === 'phase' && color === 'grey') {
                                row += caap.makeTd({text: monsterObj['status'], color: color, id: '', title: ''});
                            } else {
                                value = monsterObj[displayItem];
                                if (value !== '' && (value >= 0 || value.length)) {
                                    if (!$u.isNaN(value) && value > 999) {
                                        value = value.addCommas();
                                    }

                                    switch (displayItem) {
                                    case 'damage' :
                                        if (achLevel) {
                                            title = "User Set Monster Achievement: " + achLevel.addCommas();
                                        } else if (config.getItem('AchievementMode', false)) {
                                            title = $u.hasContent(monsterInfo) && $u.isNumber(monsterInfo.ach) ? "Default Monster Achievement: " + monsterInfo.ach.addCommas() : '';
                                            title += monsterObj['page'] === 'festival_battle_monster' ? ($u.hasContent(monsterInfo) && $u.isNumber(monsterInfo.festival_ach) ? " Festival Monster Achievement: " + monsterInfo.festival_ach.addCommas() : '') : '';
                                        } else {
                                            title = "Achievement Mode Disabled";
                                        }

                                        title += $u.hasContent(maxDamage) && $u.isNumber(maxDamage) ? " - User Set Max Damage: " + maxDamage.addCommas() : '';
                                        break;
                                    case 'time' :
                                        if ($u.hasContent(value) && value.length === 3) {
                                            value = value[0] + ":" + (value[1] < 10 ? '0' + value[1] : value[1]);
                                            duration = monsterObj['page'] === 'festival_battle_monster' ? (monsterInfo ? monsterInfo.festival_dur : 192) : (monsterInfo ? monsterInfo.duration : 192);
                                            title = $u.hasContent(duration) ? "Total Monster Duration: " + duration + " hours" : '';
                                        } else {
                                            value = '';
                                        }

                                        break;
                                    case 't2k' :
                                        value = $u.minutes2hours(value);
                                        title = "Estimated Time To Kill: " + value + " hours:mins";
                                        break;
                                    case 'life' :
                                        title = "Percentage of monster life remaining: " + value + "%";
                                        break;
                                    case 'phase' :
                                        value = value + "/" + monsterInfo.siege + " need " + monsterObj['miss'];
                                        title = "Siege Phase: " + value + " more clicks";
                                        break;
                                    case 'fortify' :
                                        title = "Percentage of party health/monster defense: " + value + "%";
                                        break;
                                    case 'strength' :
                                        title = "Percentage of party strength: " + value + "%";
                                        break;
                                    default :
                                    }

                                    row += caap.makeTd({text: value, color: color, id: id, title: title});
                                } else {
                                    row += caap.makeTd({text: '', color: color, id: '', title: ''});
                                }
                            }
                        });

                        if (monsterConditions && monsterConditions !== 'none') {
                            data = {
                                text  : '<span title="User Set Conditions: ' + monsterConditions + '" class="ui-icon ui-icon-info">i</span>',
                                color : 'blue',
                                id    : '',
                                title : ''
                            };

                            row += caap.makeTd(data);
                        } else {
                            row += caap.makeTd({text: '', color: color, id: '', title: ''});
                        }

                        if (monsterObjLink) {
                            removeLink = monsterObjLink.replace("casuser", "remove_list").replace("&action=doObjective", "").regex(linkRegExp) + (monsterObj['page'] === 'festival_battle_monster' ? '&remove_monsterKey=' + monsterObj['mid'].replace("&mid=", "") : '');
                            removeLinkInstructions = "Clicking this link will remove " + monsterObj['name'] + " from both CA and CAAP!";
                            data = {
                                text  : '<span id="caap_remove_' + count + '" title="' + removeLinkInstructions + '" mname="' + monsterObj['name'] + '" mmd5="' + monsterObj['md5'] + '" rlink="' + removeLink +
                                        '" onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';" class="ui-icon ui-icon-circle-close">X</span>',
                                color : 'blue',
                                id    : '',
                                title : ''
                            };

                            row += caap.makeTd(data);
                        } else {
                            row += caap.makeTd({text: '', color: color, id: '', title: ''});
                        }

                        body += caap.makeTr(row);
                        count += 1;
                    });

                    $j("#caap_infoMonster", caap.caapTopObject).html(
                        $j(caap.makeTable("monster", head, body)).dataTable({
                            "bAutoWidth"    : false,
                            "bFilter"       : false,
                            "bJQueryUI"     : false,
                            "bInfo"         : false,
                            "bLengthChange" : false,
                            "bPaginate"     : false,
                            "bProcessing"   : false,
                            "bStateSave"    : true,
                            "bSortClasses"  : false,
                            "aoColumnDefs"  : [
                                {
                                    "bSortable" : false,
                                    "aTargets"  : [8, 9, 10]
                                },
                                {
                                    "sSortDataType" : "remaining-time",
                                    "aTargets"      : [5, 6]
                                }
                            ]
                        })
                    );

                    handler = function (e) {
                        var visitMonsterLink = {
                                mmd5      : '',
                                mname     : '',
                                rlink     : '',
                                arlink    : ''
                            },
                            i   = 0,
                            len = 0;

                        for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                            if (e.target.attributes[i].nodeName === 'mname') {
                                visitMonsterLink.mname = e.target.attributes[i].nodeValue;
                            } else if (e.target.attributes[i].nodeName === 'rlink') {
                                visitMonsterLink.rlink = e.target.attributes[i].nodeValue;
                                visitMonsterLink.arlink = visitMonsterLink.rlink.replace(caap.domain.link + "/", "");
                            } else if (e.target.attributes[i].nodeName === 'mmd5') {
                                visitMonsterLink.mmd5 = e.target.attributes[i].nodeValue;
                            }
                        }

                        feed.setScanRecord(visitMonsterLink.mmd5);
                        caap.clickAjaxLinkSend(visitMonsterLink.arlink);
                    };

                    $j("span[id*='caap_monster_']", caap.caapTopObject).unbind('click', handler).click(handler);

                    handler = function (e) {
                        var monsterRemove = {
                                mmd5      : '',
                                mname     : '',
                                rlink     : '',
                                arlink    : ''
                            },
                            i    = 0,
                            len  = 0,
                            resp = false;

                        for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                            if (e.target.attributes[i].nodeName === 'mname') {
                                monsterRemove.mname = e.target.attributes[i].nodeValue;
                            } else if (e.target.attributes[i].nodeName === 'rlink') {
                                monsterRemove.rlink = e.target.attributes[i].nodeValue;
                                monsterRemove.arlink = monsterRemove.rlink.replace(caap.domain.link + "/", "");
                            } else if (e.target.attributes[i].nodeName === 'mmd5') {
                                monsterRemove.mmd5 = e.target.attributes[i].nodeValue;
                            }
                        }

                        resp = confirm("Are you sure you want to remove " + monsterRemove.mname + "?");
                        if (resp === true) {
                            monster.deleteItem(monsterRemove.mmd5);
                            caap.updateDashboard(true);
                            caap.clickGetCachedAjax(monsterRemove.arlink);
                        }
                    };

                    $j("span[id*='caap_remove_']", caap.caapTopObject).unbind('click', handler).click(handler);
                    state.setItem("MonsterDashUpdate", false);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in monster.dashboard: " + err);
                return false;
            }
        }
        /*jslint sub: false */
    };

    ////////////////////////////////////////////////////////////////////
    //                          guild_monster OBJECT
    // this is the main object for dealing with guild monsters
    /////////////////////////////////////////////////////////////////////

    guild_monster = {
        records: [],

        record: function () {
            this.data = {
                'name'        : '',
                'guildId'     : '',
                'slot'        : 0,
                'ticker'      : '',
                'minions'     : [],
                'attacks'     : 1,
                'damage'      : 0,
                'myStatus'    : '',
                'reviewed'    : 0,
                'state'       : '',
                'enemyHealth' : 0,
                'guildHealth' : 0,
                'conditions'  : '',
                'color'       : $u.bestTextColor(config.getItem("StyleBackgroundLight", "#E0C961"))
            };
        },

        minion: function () {
            this.data = {
                'attacking_position' : 0,
                'target_id'          : 0,
                'name'               : '',
                'level'              : 0,
                'mclass'             : '',
                'healthNum'          : 0,
                'healthMax'          : 0,
                'status'             : '',
                'percent'            : 0
            };
        },

        me: function () {
            this.data = {
                'name'               : '',
                'level'              : 0,
                'mclass'             : '',
                'healthNum'          : 0,
                'healthMax'          : 0,
                'status'             : '',
                'percent'            : 0
            };
        },

        info: {
            "Vincent": {
                twt2     : "vincent",
                special1 : [0],
                special2 : [1],
                health   : [100, 200, 400, 800],
                cta_img  : ['cta_vincent.gif']
            },
            "Alpha Vincent": {
                twt2     : "alpha_vincent",
                special1 : [0],
                special2 : [1],
                health   : [500, 1000, 2000, 4000],
                cta_img  : ['cta_alphavincent.gif']
            },
            "Army of the Apocalypse": {
                twt2     : "ca_girls",
                special1 : [0, 25, 50, 75],
                special2 : [1, 2, 3, 4],
                health   : [500, 1000, 2000, 4000],
                cta_img  : []
            },
            "Giant Arachnid": {
                twt2     : "giant_arachnid",
                special1 : [0],
                special2 : [1],
                health   : [100, 200, 400, 800],
                cta_img  : []
            }
        },

        getCtaName: function (img) {
            return guild_monster.which(img, "cta_img");
        },

        which: function (img, entity) {
            try {
                if (!$u.hasContent(img) || !$u.isString(img)) {
                    $u.warn("img", img);
                    throw "Invalid identifying img!";
                }

                if (!$u.hasContent(entity) || !$u.isString(entity)) {
                    $u.warn("entity", entity);
                    throw "Invalid entity name!";
                }

                var i    = '',
                    k    = 0,
                    r    = {},
                    name = '';

                for (i in guild_monster.info) {
                    if (guild_monster.info.hasOwnProperty(i)) {
                        if ($u.hasContent(name)) {
                            break;
                        }

                        r = guild_monster.info[i];
                        if (!$u.hasContent(r) || !$u.hasContent(r[entity]) || !$j.isArray(r[entity])) {
                            continue;
                        }

                        for (k = 0; k < r[entity].length; k += 1) {
                            if (img === r[entity][k]) {
                                name = i;
                                break;
                            }
                        }
                    }
                }

                return name;
            } catch (err) {
                $u.error("ERROR in guild_monster.which: " + err);
                return undefined;
            }
        },

        load: function () {
            try {
                guild_monster.records = gm.getItem('guild_monster.records', 'default');
                if (guild_monster.records === 'default' || !$j.isArray(guild_monster.records)) {
                    guild_monster.records = gm.setItem('guild_monster.records', []);
                }

                state.setItem("GuildMonsterDashUpdate", true);
                $u.log(3, "guild_monster.load", guild_monster.records);
                return true;
            } catch (err) {
                $u.error("ERROR in guild_monster.load: " + err);
                return false;
            }
        },

        save: function () {
            try {
                gm.setItem('guild_monster.records', guild_monster.records);
                state.setItem("GuildMonsterDashUpdate", true);
                $u.log(3, "guild_monster.save", guild_monster.records);
                return true;
            } catch (err) {
                $u.error("ERROR in guild_monster.save: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        getItem: function (slot) {
            try {
                var it        = 0,
                    len       = 0,
                    success   = false,
                    newRecord = {};

                if (!$u.isNumber(slot)) {
                    $u.warn("slot", slot);
                    throw "Invalid identifying slot!";
                }

                if (slot === '') {
                    return '';
                }

                for (it = 0, len = guild_monster.records.length; it < len; it += 1) {
                    if (guild_monster.records[it]['slot'] === slot) {
                        success = true;
                        break;
                    }
                }

                if (success) {
                    $u.log(3, "Got guild_monster record", slot, guild_monster.records[it]);
                    return guild_monster.records[it];
                } else {
                    newRecord = new guild_monster.record();
                    newRecord.data['slot'] = slot;
                    $u.log(3, "New guild_monster record", slot, newRecord.data);
                    return newRecord.data;
                }
            } catch (err) {
                $u.error("ERROR in guild_monster.getItem: " + err);
                return false;
            }
        },

        setItem: function (record) {
            try {
                if (!record || !$j.isPlainObject(record)) {
                    throw "Not passed a record";
                }

                if (!$u.isNumber(record['slot']) || record['slot'] <= 0) {
                    $u.warn("slot", record['slot']);
                    throw "Invalid identifying slot!";
                }

                var it      = 0,
                    len     = 0,
                    success = false;

                for (it = 0, len = guild_monster.records.length; it < len; it += 1) {
                    if (guild_monster.records[it]['slot'] === record['slot']) {
                        success = true;
                        break;
                    }
                }

                if (success) {
                    guild_monster.records[it] = record;
                    $u.log(3, "Updated guild_monster record", record, guild_monster.records);
                } else {
                    guild_monster.records.push(record);
                    $u.log(3, "Added guild_monster record", record, guild_monster.records);
                }

                guild_monster.save();
                return true;
            } catch (err) {
                $u.error("ERROR in guild_monster.setItem: " + err);
                return false;
            }
        },

        deleteItem: function (slot) {
            try {
                var it        = 0,
                    len       = 0,
                    success   = false;

                if (!$u.isNumber(slot) || slot <= 0) {
                    $u.warn("slot", slot);
                    throw "Invalid identifying slot!";
                }

                for (it = 0, len = guild_monster.records.length; it < len; it += 1) {
                    if (guild_monster.records[it]['slot'] === slot) {
                        success = true;
                        break;
                    }
                }

                if (success) {
                    guild_monster.records.splice(it, 1);
                    guild_monster.save();
                    $u.log(3, "Deleted guild_monster record", slot, guild_monster.records);
                    return true;
                } else {
                    $u.warn("Unable to delete guild_monster record", slot, guild_monster.records);
                    return false;
                }
            } catch (err) {
                $u.error("ERROR in guild_monster.deleteItem: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        clear: function () {
            try {
                $u.log(1, "guild_monster.clear");
                guild_monster.records = gm.setItem("guild_monster.records", []);
                state.setItem('staminaGuildMonster', 0);
                state.setItem('targetGuildMonster', {});
                state.setItem("GuildMonsterDashUpdate", true);
                return true;
            } catch (err) {
                $u.error("ERROR in guild_monster.clear: " + err);
                return false;
            }
        },

        navigate_to_main: function () {
            return caap.navigateTo('guild', 'tab_guild_main_on.gif');
        },

        navigate_to_battles_refresh: function () {
            var button = caap.checkForImage("guild_monster_tab_on.jpg");
            if ($u.hasContent(button)) {
                caap.click(button);
            }

            state.setItem('guildMonsterBattlesRefresh', false);
            return $u.hasContent(button);
        },

        navigate_to_battles: function () {
            return caap.navigateTo('guild,guild_current_monster_battles', 'guild_monster_tab_on.jpg');
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        populate: function () {
            try {
                var buttons = $j("input[src*='dragon_list_btn_']"),
                    slotArr = [],
                    it      = 0;

                if (buttons && buttons.length) {
                    buttons.each(function () {
                        var button        = $j(this),
                            form          = null,
                            currentRecord = {},
                            imageName     = '',
                            slot          = 0,
                            name          = '',
                            guildId       = '',
                            passed        = true;

                        form = button.parents("form").eq(0);
                        if (form && form.length) {
                            slot = form.find("input[name='slot']").eq(0).attr("value");
                            slot = slot ? slot.parseInt() : 0;
                            if ($u.isNumber(slot) && slot > 0 && slot <= 5) {
                                $u.log(3, "slot", slot);
                                slotArr.push(slot);
                                currentRecord = guild_monster.getItem(slot);
                                name = button.parents().eq(4).text();
                                name = name ? name.trim() : '';
                                if (name) {
                                    if (currentRecord['name'] !== name) {
                                        $u.log(1, "Updated name", currentRecord['name'], name);
                                        currentRecord['name'] = name;
                                    }
                                } else {
                                    $u.warn("name error", name);
                                    passed = false;
                                }

                                guildId = form.find("input[name='guild_id']").eq(0).attr("value");
                                if (caap.stats['guild']['id'] && guildId === caap.stats['guild']['id']) {
                                    if (currentRecord['guildId'] !== guildId) {
                                        $u.log(2, "Updated guildId", currentRecord['guildId'], guildId);
                                        currentRecord['guildId'] = guildId;
                                    }
                                } else {
                                    $u.warn("guildId error", guildId, caap.stats['guild']['id']);
                                    passed = false;
                                }

                                imageName = button.attr("src").basename();
                                if (imageName) {
                                    switch (imageName) {
                                    case "dragon_list_btn_3.jpg":
                                        currentRecord['color'] = $u.bestTextColor(config.getItem("StyleBackgroundLight", "#E0C961"));
                                        currentRecord['state'] = "Alive";
                                        break;
                                    case "dragon_list_btn_2.jpg":
                                    case "dragon_list_btn_4.jpg":
                                        currentRecord['color'] = "grey";
                                        if (currentRecord['state'] !== "Completed") {
                                            $u.log(2, "Updated state", currentRecord['state'], "Collect");
                                            currentRecord['state'] = "Collect";
                                        }

                                        break;
                                    default:
                                        currentRecord['state'] = "Error";
                                        $u.warn("state error", imageName);
                                        passed = false;
                                    }
                                } else {
                                    $u.warn("imageName error", button.attr("src"), imageName);
                                    passed = false;
                                }
                            } else {
                                $u.warn("slot error", slot);
                                passed = false;
                            }
                        } else {
                            $u.warn("form error", button);
                            passed = false;
                        }

                        if (passed) {
                            $u.log(2, "currentRecord/button", currentRecord, button);
                            guild_monster.setItem(currentRecord);
                        } else {
                            $u.warn("populate record failed", currentRecord, button);
                        }
                    });

                    for (it = guild_monster.records.length - 1; it >= 0; it -= 1) {
                        if (!slotArr.hasIndexOf(guild_monster.records[it]['slot'])) {
                            guild_monster.deleteItem(guild_monster.records[it]['slot']);
                        }
                    }

                    guild_monster.select(true);
                } else {
                    $u.log(1, "No buttons found");
                    guild_monster.clear();
                }

                caap.updateDashboard(true);
                return true;
            } catch (err) {
                $u.error("ERROR in guild_monster.populate: " + err);
                return false;
            }
        },

        onMonster: function () {
            try {
                var gates         = $j(),
                    health        = $j(),
                    healthGuild   = $j(),
                    healthEnemy   = $j(),
                    allowedDiv    = $j(),
                    bannerDiv     = $j(),
                    collectDiv    = $j(),
                    tempDiv       = $j(),
                    tempTxt       = '',
                    collect       = false,
                    myStatsTxt    = '',
                    myStatsArr    = [],
                    slot          = 0,
                    currentRecord = {},
                    minionRegEx   = new RegExp("(.*) Level (\\d+) Class: (.*) Health: (.+)/(.+) Status: (.*)");

                caap.chatLink(caap.appBodyDiv, "#" +  caap.domain.id[caap.domain.which] + "guild_war_chat_log div[style*='border-bottom: 1px'] div[style*='font-size: 15px']");
                slot = $j("input[name='slot']").eq(0).attr("value");
                slot = slot ? slot.parseInt() : 0;
                bannerDiv = $j("#" +  caap.domain.id[caap.domain.which] + "guild_battle_banner_section");
                myStatsTxt = bannerDiv.children().eq(2).children().eq(0).children().eq(1).text();
                myStatsTxt = myStatsTxt ? myStatsTxt.trim().innerTrim() : '';
                if ($u.isNumber(slot) && slot > 0 && slot <= 5) {
                    $u.log(3, "slot", slot);
                    currentRecord = guild_monster.getItem(slot);
                    currentRecord['minions'] = [];
                    currentRecord['ticker'] = '';
                    currentRecord['guildHealth'] = 0;
                    currentRecord['enemyHealth'] = 0;
                    if (!bannerDiv.attr("style").match(/_dead/)) {
                        currentRecord['ticker'] = $j("#" +  caap.domain.id[caap.domain.which] + "monsterTicker").text();
                        currentRecord['ticker'] = currentRecord['ticker'] ? currentRecord['ticker'].trim() : '';
                        if (myStatsTxt) {
                            $u.log(3, "myStatsTxt", myStatsTxt);
                            myStatsArr = myStatsTxt.match(new RegExp("(.+) Level: (\\d+) Class: (.+) Health: (\\d+)/(\\d+).+Status: (.+) Battle Damage: (\\d+)"));
                            if (myStatsArr && myStatsArr.length === 8) {
                                $u.log(2, "myStatsArr", myStatsArr);
                                currentRecord['damage'] = myStatsArr[7] ? myStatsArr[7].parseInt() : 0;
                                currentRecord['myStatus'] = myStatsArr[6] ? myStatsArr[6].trim() : '';
                            } else {
                                $u.warn("myStatsArr error", myStatsArr, myStatsTxt);
                            }
                        }

                        allowedDiv = $j("#" +  caap.domain.id[caap.domain.which] + "allowedAttacks");
                        if (allowedDiv && allowedDiv.length) {
                            currentRecord['attacks'] = allowedDiv.attr("value") ? allowedDiv.attr("value").parseInt() : 1;
                            if (currentRecord['attacks'] < 1 || currentRecord['attacks'] > 5) {
                                currentRecord['attacks'] = 1;
                                $u.warn("Invalid allowedAttacks");
                            }
                        } else {
                            $u.warn("Could not find allowedAttacks");
                        }

                        health = $j("#" +  caap.domain.id[caap.domain.which] + "guild_battle_health");
                        if (health && health.length) {
                            healthEnemy = $j("div[style*='guild_battle_bar_enemy.gif']", health).eq(0);
                            if ($u.hasContent(healthEnemy)) {
                                currentRecord['enemyHealth'] = (100 - healthEnemy.getPercent('width')).dp(2);
                            } else {
                                $u.warn("guild_battle_bar_enemy.gif not found");
                            }

                            healthGuild = $j("div[style*='guild_battle_bar_you.gif']", health).eq(0);
                            if ($u.hasContent(healthGuild)) {
                                currentRecord['guildHealth'] = (100 - healthGuild.getPercent('width')).dp(2);
                            } else {
                                $u.warn("guild_battle_bar_you.gif not found");
                            }

                            tempDiv = $j("span", health);
                            if ($u.hasContent(tempDiv) && tempDiv.length === 2) {
                                tempTxt = tempDiv.eq(0).text().trim();
                                tempDiv.eq(0).text(tempTxt + " (" + currentRecord['guildHealth'] + "%)");
                                tempTxt = tempDiv.eq(1).text().trim();
                                tempDiv.eq(1).text(tempTxt + " (" + currentRecord['enemyHealth'] + "%)");
                            }
                        } else {
                            $u.warn("guild_battle_health error");
                        }

                        gates = $j("div[id*='" +  caap.domain.id[caap.domain.which] + "enemy_guild_member_list_']");
                        if (!gates || !gates.length) {
                            $u.warn("No gates found");
                        } else if (gates && gates.length !== 4) {
                            $u.warn("Not enough gates found");
                        } else {
                            gates.each(function (gIndex) {
                                var memberDivs = $j(this).children();
                                if (!memberDivs || !memberDivs.length) {
                                    $u.warn("No members found");
                                } else if (memberDivs && memberDivs.length !== 25) {
                                    $u.warn("Not enough members found", memberDivs);
                                } else {
                                    memberDivs.each(function (mIndex) {
                                        var member       = $j(this),
                                            memberText   = '',
                                            memberArr    = [],
                                            targetIdDiv  = $j(),
                                            memberRecord = new guild_monster.minion().data;

                                        memberRecord['attacking_position'] = (gIndex + 1);
                                        targetIdDiv = member.find("input[name='target_id']").eq(0);
                                        if (targetIdDiv && targetIdDiv.length) {
                                            memberRecord['target_id'] = targetIdDiv.attr("value") ? targetIdDiv.attr("value").parseInt() : 1;
                                        } else {
                                            $u.warn("Unable to find target_id for minion!", member);
                                        }

                                        memberText = member.children().eq(1).text();
                                        memberText = memberText ? memberText.trim().innerTrim() : '';
                                        memberArr = memberText.match(minionRegEx);
                                        if (memberArr && memberArr.length === 7) {
                                            memberRecord['name'] = memberArr[1] ? memberArr[1] : '';
                                            memberRecord['level'] = memberArr[2] ? memberArr[2].parseInt() : 0;
                                            memberRecord['mclass'] = memberArr[3] ? memberArr[3] : '';
                                            memberRecord['healthNum'] = memberArr[4] ? memberArr[4].parseInt() : 0;
                                            memberRecord['healthMax'] = memberArr[5] ? memberArr[5].parseInt() : 1;
                                            memberRecord['status'] = memberArr[6] ? memberArr[6] : '';
                                            memberRecord['percent'] = ((memberRecord['healthNum'] / memberRecord['healthMax']) * 100).dp(2);
                                        }

                                        currentRecord['minions'].push(memberRecord);
                                    });
                                }
                            });
                        }
                    } else {
                        collectDiv = $j("input[src*='collect_reward_button2.jpg']");
                        if (collectDiv && collectDiv.length) {
                            $u.log(1, "Monster is dead and ready to collect");
                            currentRecord['state'] = 'Collect';
                            if (config.getItem('guildMonsterCollect', false)) {
                                collect = true;
                            }
                        } else {
                            $u.log(1, "Monster is completed");
                            currentRecord['state'] = 'Completed';
                        }

                        currentRecord['color'] = "grey";
                    }

                    currentRecord['reviewed'] = new Date().getTime();
                    $u.log(2, "currentRecord", currentRecord);
                    guild_monster.setItem(currentRecord);
                    if (collect) {
                        caap.click(collectDiv);
                    }
                } else {
                    if (bannerDiv.children().eq(0).text().hasIndexOf("You do not have an on going guild monster battle. Have your Guild initiate more!")) {
                        slot = state.getItem('guildMonsterReviewSlot', 0);
                        if ($u.isNumber(slot) && slot > 0 && slot <= 5) {
                            $u.log(1, "monster expired", slot);
                            guild_monster.deleteItem(slot);
                        } else {
                            $u.warn("monster expired slot error", slot);
                        }
                    } else {
                        $u.log(1, "On another guild's monster", myStatsTxt);
                    }
                }

                return true;
            } catch (err) {
                $u.error("ERROR in guild_monster.onMonster: " + err);
                return false;
            }
        },

        getReview: function () {
            try {
                var it     = 0,
                    len    = 0;

                for (it = 0, len = guild_monster.records.length; it < len; it += 1) {
                    if (guild_monster.records[it]['state'] === 'Completed') {
                        continue;
                    }

                    if (!schedule.since(guild_monster.records[it]['reviewed'], 30 * 60)) {
                        continue;
                    }

                    break;
                }

                return guild_monster.records[it];
            } catch (err) {
                $u.error("ERROR in guild_monster.getReview: " + err);
                return undefined;
            }
        },

        checkPage: function (record) {
            try {
                if (!record || !$j.isPlainObject(record)) {
                    throw "Not passed a record";
                }

                var slot = 0;
                slot = $j("input[name='slot']").eq(0).attr("value");
                slot = slot ? slot.parseInt() : 0;
                return (record['slot'] === slot);
            } catch (err) {
                $u.error("ERROR in guild_monster.checkPage: " + err);
                return undefined;
            }
        },

        getTargetMinion: function (record) {
            try {
                var it              = 0,
                    ol              = 0,
                    len             = 0,
                    alive           = 0,
                    minion          = {},
                    minHealth       = 0,
                    specialTargets  = [],
                    firstSpecial    = -1,
                    ignoreClerics   = false,
                    attackOrderList = [],
                    isSpecial       = false,
                    isMatch         = false,
                    attackNorth     = config.getItem('attackGateNorth', true),
                    attackEast      = config.getItem('attackGateEast', true),
                    attackSouth     = config.getItem('attackGateSouth', true),
                    attackWest      = config.getItem('attackGateWest', true);

                if (!record || !$j.isPlainObject(record)) {
                    throw "Not passed a record";
                }

                minHealth = config.getItem('IgnoreMinionsBelow', 0);
                if (!$u.isNumber(minHealth)) {
                    minHealth = 0;
                }

                attackOrderList = config.getList('orderGuildMinion', '');
                if (!attackOrderList || attackOrderList.length === 0) {
                    attackOrderList = [String.fromCharCode(0)];
                    $u.log(2, "Added null character to getTargetMinion attackOrderList", attackOrderList);
                }

                ignoreClerics = config.getItem('ignoreClerics', false);
                for (ol = 0, len = attackOrderList.length; ol < len; ol += 1) {
                    if (minion && $j.isPlainObject(minion) && !$j.isEmptyObject(minion)) {
                        $u.log(2, "Minion matched and set - break", minion);
                        break;
                    }

                    specialTargets = guild_monster.info[record['name']].special1.slice();
                    for (it = record['minions'].length - 1; it >= 0; it -= 1) {
                        if (!attackNorth && record['minions'][it]['attacking_position'] === 1) {
                            $u.log(2, "Skipping North Minion", it, record['minions'][it]);
                            continue;
                        }

                        if (!attackWest && record['minions'][it]['attacking_position'] === 2) {
                            $u.log(2, "Skipping West Minion", it, record['minions'][it]);
                            continue;
                        }

                        if (!attackEast && record['minions'][it]['attacking_position'] === 3) {
                            $u.log(2, "Skipping East Minion", it, record['minions'][it]);
                            continue;
                        }

                        if (!attackSouth && record['minions'][it]['attacking_position'] === 4) {
                            $u.log(2, "Skipping South Minion", it, record['minions'][it]);
                            continue;
                        }

                        if (attackOrderList[ol] === String.fromCharCode(0)) {
                            isMatch = true;
                        } else {
                            isMatch = !record['minions'][it]['name'].toLowerCase().hasIndexOf(attackOrderList[ol].match(new RegExp("^[^:]+")).toString().trim().toLowerCase());
                        }

                        if (isMatch) {
                            $u.log(2, "Minion matched", it, record['minions'][it]);
                        }

                        isSpecial = specialTargets.hasIndexOf(it);
                        if (record['minions'][it]['status'] === 'Stunned') {
                            if (isSpecial && $u.isNaN(record['minions'][it]['healthNum'])) {
                                specialTargets.pop();
                                if (isMatch) {
                                    $u.log(2, "Special minion stunned", specialTargets);
                                }
                            } else if (isMatch) {
                                $u.log(2, "Minion stunned");
                            }

                            continue;
                        }

                        // need to look at this when next fighting one, don't think ignore cleric code is correct
                        if (isSpecial) {
                            if (!$u.isNaN(record['minions'][it]['healthNum'])) {
                                specialTargets.pop();
                                $u.log(2, "Not special minion", it, specialTargets);
                                if (ignoreClerics && record['minions'][it]['mclass'] === "Cleric") {
                                    $u.log(2, "Ignoring Cleric", record['minions'][it]);
                                    continue;
                                }
                            } else if (firstSpecial < 0) {
                                firstSpecial = it;
                                $u.log(2, "firstSpecial minion", firstSpecial);
                            } else {
                                $u.log(2, "Special minion", it, specialTargets);
                            }
                        } else {
                            if (ignoreClerics && record['minions'][it]['mclass'] === "Cleric") {
                                $u.log(2, "Ignoring Cleric", record['minions'][it]);
                                continue;
                            }
                        }

                        if (minHealth && !isSpecial) {
                            if (record['minions'][it]['healthNum'] < minHealth) {
                                if (!alive) {
                                    alive = it;
                                    $u.log(2, "First alive", alive);
                                }

                                continue;
                            }
                        }

                        if (!isMatch) {
                            continue;
                        }

                        minion = record['minions'][it];
                        break;
                    }
                }

                if ($j.isEmptyObject(minion) && firstSpecial >= 0) {
                    minion = record['minions'][firstSpecial];
                    $u.log(2, "Target Special", firstSpecial, record['minions'][firstSpecial]);
                }

                if (config.getItem('chooseIgnoredMinions', false) && alive) {
                    minion = record['minions'][alive];
                    $u.log(2, "Target Alive", alive, record['minions'][alive]);
                }

                $u.log(2, "Target minion", minion);
                return minion;
            } catch (err) {
                $u.error("ERROR in guild_monster.getTargetMinion: " + err);
                return undefined;
            }
        },

        select: function (force) {
            try {
                var it              = 0,
                    ol              = 0,
                    len             = 0,
                    len1            = 0,
                    attackOrderList = [],
                    conditions      = '',
                    ach             = 999999,
                    max             = 999999,
                    target          = {},
                    firstOverAch    = {},
                    firstUnderMax   = {};

                if (!(force || schedule.oneMinuteUpdate('selectGuildMonster'))) {
                    return state.getItem('targetGuildMonster', {});
                }

                state.setItem('targetGuildMonster', {});
                attackOrderList = config.getList('orderGuildMonster', '');
                if (!attackOrderList || attackOrderList.length === 0) {
                    attackOrderList = [String.fromCharCode(0)];
                    $u.log(3, "Added null character to select attackOrderList", attackOrderList);
                }

                for (it = guild_monster.records.length - 1; it >= 0; it -= 1) {
                    if (guild_monster.records[it]['state'] !== 'Alive') {
                        guild_monster.records[it]['color'] = "grey";
                        guild_monster.records[it]['conditions'] = '';
                        continue;
                    }

                    attackOrderList.push(guild_monster.records[it]['slot'].toString());
                    guild_monster.records[it]['conditions'] = 'none';
                    guild_monster.records[it]['color'] = $u.bestTextColor(config.getItem("StyleBackgroundLight", "#E0C961"));
                }

                for (ol = 0, len1 = attackOrderList.length; ol < len1; ol += 1) {
                    conditions = attackOrderList[ol].replace(new RegExp("^[^:]+"), '').toString().trim();
                    for (it = 0, len = guild_monster.records.length; it < len; it += 1) {
                        if (guild_monster.records[it]['state'] !== 'Alive') {
                            guild_monster.records[it]['color'] = "grey";
                            continue;
                        }

                        if (guild_monster.records[it]['myStatus'] === 'Stunned') {
                            guild_monster.records[it]['color'] = "purple";
                            continue;
                        }

                        if (guild_monster.records[it]['conditions'] !== 'none') {
                            continue;
                        }

                        if (attackOrderList[ol] !== String.fromCharCode(0)) {
                            if (!(guild_monster.records[it]['slot'] + " " + guild_monster.records[it]['name'].toLowerCase()).hasIndexOf(attackOrderList[ol].match(new RegExp("^[^:]+")).toString().trim().toLowerCase())) {
                                continue;
                            }
                        }

                        if (conditions) {
                            guild_monster.records[it]['conditions'] = conditions;
                            if (conditions.hasIndexOf("ach")) {
                                ach = monster.parseCondition('ach', conditions);
                            }

                            if (conditions.hasIndexOf("max")) {
                                max = monster.parseCondition('max', conditions);
                            }
                        }

                        if (guild_monster.records[it]['damage'] >= ach) {
                            guild_monster.records[it]['color'] = "darkorange";
                            if (!firstOverAch || !$j.isPlainObject(firstOverAch) || $j.isEmptyObject(firstOverAch)) {
                                if (guild_monster.records[it]['damage'] >= max) {
                                    guild_monster.records[it]['color'] = "red";
                                    $u.log(2, 'OverMax', guild_monster.records[it]);
                                } else {
                                    firstOverAch = guild_monster.records[it];
                                    $u.log(2, 'firstOverAch', firstOverAch);
                                }
                            }
                        } else if (guild_monster.records[it]['damage'] < max) {
                            if (!firstUnderMax || !$j.isPlainObject(firstUnderMax) || $j.isEmptyObject(firstUnderMax)) {
                                firstUnderMax = guild_monster.records[it];
                                $u.log(2, 'firstUnderMax', firstUnderMax);
                            }
                        } else {
                            guild_monster.records[it]['color'] = "red";
                            $u.log(2, 'OverMax', guild_monster.records[it]);
                        }
                    }
                }

                target = firstUnderMax;
                if (!target || !$j.isPlainObject(target) || $j.isEmptyObject(target)) {
                    target = firstOverAch;
                }

                $u.log(2, 'Guild Monster Target', target);
                if (target && $j.isPlainObject(target) && !$j.isEmptyObject(target)) {
                    target['color'] = 'green';
                    guild_monster.setItem(target);
                } else {
                    state.setItem('guildMonsterBattlesBurn', false);
                    guild_monster.save();
                }

                return state.setItem('targetGuildMonster', target);
            } catch (err) {
                $u.error("ERROR in guild_monster.select: " + err);
                return undefined;
            }
        },
        /*jslint sub: false */

        attack2stamina: {
            1: 1,
            2: 5,
            3: 10,
            4: 20,
            5: 50
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        getAttackValue: function (record, minion) {
            try {
                if (!minion || !$j.isPlainObject(minion)) {
                    throw "Not passed a minion";
                }

                var attack         = 0,
                    recordInfo     = guild_monster.info[record['name']],
                    specialTargets = recordInfo.special2.slice();

                if (specialTargets.hasIndexOf(minion['target_id']) && $u.isNaN(minion['healthNum'])) {
                    if (caap.stats['staminaT']['num'] < 5) {
                        attack = 1;
                    } else if (caap.stats['staminaT']['num'] < 10) {
                        attack = 2;
                    } else if (caap.stats['staminaT']['num'] < 20) {
                        attack = 3;
                    } else if (caap.stats['staminaT']['num'] < 50) {
                        attack = 4;
                    } else {
                        attack = 5;
                    }
                } else if (minion['healthNum'] < recordInfo.health[0]) {
                    attack = 1;
                } else if (minion['healthNum'] < recordInfo.health[1]) {
                    if (caap.stats['staminaT']['num'] < 5) {
                        attack = 1;
                    } else {
                        attack = 2;
                    }
                } else if (minion['healthNum'] < recordInfo.health[2]) {
                    if (caap.stats['staminaT']['num'] < 5) {
                        attack = 1;
                    } else if (caap.stats['staminaT']['num'] < 10) {
                        attack = 2;
                    } else {
                        attack = 3;
                    }
                } else if (minion['healthNum'] < recordInfo.health[3]) {
                    if (caap.stats['staminaT']['num'] < 5) {
                        attack = 1;
                    } else if (caap.stats['staminaT']['num'] < 10) {
                        attack = 2;
                    } else if (caap.stats['staminaT']['num'] < 20) {
                        attack = 3;
                    } else {
                        attack = 4;
                    }
                } else {
                    if (caap.stats['staminaT']['num'] < 5) {
                        attack = 1;
                    } else if (caap.stats['staminaT']['num'] < 10) {
                        attack = 2;
                    } else if (caap.stats['staminaT']['num'] < 20) {
                        attack = 3;
                    } else if (caap.stats['staminaT']['num'] < 50) {
                        attack = 4;
                    } else {
                        attack = 5;
                    }
                }

                if (attack > record['attacks']) {
                    attack = record['attacks'];
                }

                $u.log(2, 'getAttackValue', attack);
                return attack;
            } catch (err) {
                $u.error("ERROR in guild_monster.getAttackValue: " + err);
                return undefined;
            }
        },

        getStaminaValue: function (record, minion) {
            try {
                if (!minion || !$j.isPlainObject(minion)) {
                    throw "Not passed a minion";
                }

                var stamina        = 0,
                    staminaCap     = 0,
                    recordInfo     = guild_monster.info[record['name']],
                    specialTargets = recordInfo.special2.slice();

                if (specialTargets.hasIndexOf(minion['target_id']) && $u.isNaN(minion['healthNum'])) {
                    stamina = 50;
                } else if (minion['healthNum'] < recordInfo.health[0]) {
                    stamina = 1;
                } else if (minion['healthNum'] < recordInfo.health[1]) {
                    stamina = 5;
                } else if (minion['healthNum'] < recordInfo.health[2]) {
                    stamina = 10;
                } else if (minion['healthNum'] < recordInfo.health[3]) {
                    stamina = 20;
                } else {
                    stamina = 50;
                }

                staminaCap = guild_monster.attack2stamina[record['attacks']];
                if (stamina > staminaCap) {
                    stamina = staminaCap;
                }

                $u.log(2, 'getStaminaValue', stamina);
                return stamina;
            } catch (err) {
                $u.error("ERROR in guild_monster.getStaminaValue: " + err);
                return undefined;
            }
        },
        /*jslint sub: false */

        menu: function () {
            try {
                // Guild Monster controls
                var mbattleList = [
                        'Stamina Available',
                        'At Max Stamina',
                        'At X Stamina',
                        'Never'
                    ],
                    mbattleInst = [
                        'Stamina Available will attack whenever you have enough stamina',
                        'At Max Stamina will attack when stamina is at max and will burn down all stamina when able to level up',
                        'At X Stamina you can set maximum and minimum stamina to battle',
                        'Never - disables attacking monsters'
                    ],
                    htmlCode = '';

                htmlCode += caap.startToggle('GuildMonsters', 'GUILD MONSTERS');
                htmlCode += caap.makeDropDownTR("Attack When", 'WhenGuildMonster', mbattleList, mbattleInst, '', 'Never', false, false, 62);
                htmlCode += caap.startDropHide('WhenGuildMonster', '', 'Never', true);
                htmlCode += caap.startDropHide('WhenGuildMonster', 'XStamina', 'At X Stamina', false);
                htmlCode += caap.makeNumberFormTR("Start At Or Above", 'MaxStaminaToGMonster', '', 0, '', '', true, false);
                htmlCode += caap.makeNumberFormTR("Stop At Or Below", 'MinStaminaToGMonster', '', 0, '', '', true, false);
                htmlCode += caap.endDropHide('WhenGuildMonster', 'XStamina');
                htmlCode += caap.makeCheckTR('Classic Monsters First', 'doClassicMonstersFirst', false, 'Prioritise the classic monsters and raids before Guild Monsters.');
                htmlCode += caap.makeCheckTR('Siege Monster', 'doGuildMonsterSiege', true, 'Perform siege assists when visiting your Guild Monster.');
                htmlCode += caap.makeCheckTR('Collect Rewards', 'guildMonsterCollect', false, 'Collect the rewards of your completed Guild Monsters.');
                htmlCode += caap.makeCheckTR("Don't Attack Clerics", 'ignoreClerics', false, "Do not attack Guild Monster's Clerics. Does not include the Gate minions e.g. Azriel");
                htmlCode += caap.makeTD("Attack Gates");
                htmlCode += caap.makeTD("N" + caap.makeCheckBox('attackGateNorth', true), false, true, "display: inline-block; width: 25%;");
                htmlCode += caap.makeTD("W" + caap.makeCheckBox('attackGateWest', true), false, true, "display: inline-block; width: 25%;");
                htmlCode += caap.makeTD("E" + caap.makeCheckBox('attackGateEast', true), false, true, "display: inline-block; width: 25%;");
                htmlCode += caap.makeTD("S" + caap.makeCheckBox('attackGateSouth', true), false, true, "display: inline-block; width: 25%;");
                htmlCode += caap.makeNumberFormTR("Ignore Below Health", 'IgnoreMinionsBelow', "Don't attack monster minions that have a health below this value.", 0, '', '');
                htmlCode += caap.makeCheckTR('Choose First Alive', 'chooseIgnoredMinions', false, 'When the only selection left is the monster general then go back and attack any previously ignored monster minions.');
                htmlCode += caap.makeTD("Attack Monsters in this order");
                htmlCode += caap.makeTextBox('orderGuildMonster', 'Attack your guild monsters in this order, can use Slot Number and Name. Control is provided by using :ach and :max', '', '');
                htmlCode += caap.makeTD("Attack Minions in this order");
                htmlCode += caap.makeTextBox('orderGuildMinion', 'Attack your guild minions in this order. Uses the minion name.', '', '');
                htmlCode += caap.endDropHide('WhenGuildMonster');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in guild_monster.menu: " + err);
                return '';
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        dashboard: function () {
            try {
                /*-------------------------------------------------------------------------------------\
                Next we build the HTML to be included into the 'caap_guildMonster' div. We set our
                table and then build the header row.
                \-------------------------------------------------------------------------------------*/
                if (config.getItem('DBDisplay', '') === 'Guild Monster' && state.getItem("GuildMonsterDashUpdate", true)) {
                    var color   = '',
                        headers = ['Slot', 'Name', 'Damage', 'Damage%',     'My Status', 'TimeLeft', 'Status', 'Link', '&nbsp;'],
                        values  = ['slot', 'name', 'damage', 'enemyHealth', 'myStatus',  'ticker',   'state'],
                        pp      = 0,
                        i       = 0,
                        len     = 0,
                        len1    = 0,
                        data    = {text: '', color: '', bgcolor: '', id: '', title: ''},
                        handler = null,
                        head    = '',
                        body    = '',
                        row     = '';

                    for (pp = 0; pp < headers.length; pp += 1) {
                        head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: ''});
                    }

                    head = caap.makeTr(head);
                    for (i = 0, len = guild_monster.records.length; i < len; i += 1) {
                        row = "";
                        for (pp = 0, len1 = values.length; pp < len1; pp += 1) {
                            switch (values[pp]) {
                            case 'name' :
                                data = {
                                    text  : '<span id="caap_guildmonster_' + pp + '" title="Clicking this link will take you to (' + guild_monster.records[i]['slot'] + ') ' + guild_monster.records[i]['name'] +
                                            '" mname="' + guild_monster.records[i]['slot'] + '" rlink="guild_battle_monster.php?twt2=' + guild_monster.info[guild_monster.records[i]['name']].twt2 + '&guild_id=' + guild_monster.records[i]['guildId'] +
                                            '&slot=' + guild_monster.records[i]['slot'] + '" onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';">' + guild_monster.records[i]['name'] + '</span>',
                                    color : guild_monster.records[i]['color'],
                                    id    : '',
                                    title : ''
                                };

                                row += caap.makeTd(data);
                                break;
                            case 'ticker' :
                                row += caap.makeTd({text: $u.hasContent(guild_monster.records[i][values[pp]]) ? guild_monster.records[i][values[pp]].regex(/(\d+:\d+):\d+/) : '', color: guild_monster.records[i]['color'], id: '', title: ''});
                                break;
                            default :
                                row += caap.makeTd({text: $u.hasContent(guild_monster.records[i][values[pp]]) ? guild_monster.records[i][values[pp]] : '', color: guild_monster.records[i]['color'], id: '', title: ''});
                            }
                        }

                        data = {
                            text  : '<a href="' + caap.domain.link + '/guild_battle_monster.php?twt2=' + guild_monster.info[guild_monster.records[i]['name']].twt2 +
                                    '&guild_id=' + guild_monster.records[i]['guildId'] + '&action=doObjective&slot=' + guild_monster.records[i]['slot'] + '&ref=nf">Link</a>',
                            color : 'blue',
                            id    : '',
                            title : 'This is a siege link.'
                        };

                        row += caap.makeTd(data);

                        if ($u.hasContent(guild_monster.records[i]['conditions']) && guild_monster.records[i]['conditions'] !== 'none') {
                            data = {
                                text  : '<span title="User Set Conditions: ' + guild_monster.records[i]['conditions'] + '" class="ui-icon ui-icon-info">i</span>',
                                color : guild_monster.records[i]['color'],
                                id    : '',
                                title : ''
                            };

                            row += caap.makeTd(data);
                        } else {
                            row += caap.makeTd({text: '', color: color, id: '', title: ''});
                        }

                        body += caap.makeTr(row);
                    }

                    $j("#caap_guildMonster", caap.caapTopObject).html(caap.makeTable("guild_monster", head, body));

                    handler = function (e) {
                        var visitMonsterLink = {
                                mname     : '',
                                arlink    : ''
                            },
                            i   = 0,
                            len = 0;

                        for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                            if (e.target.attributes[i].nodeName === 'mname') {
                                visitMonsterLink.mname = e.target.attributes[i].nodeValue;
                            } else if (e.target.attributes[i].nodeName === 'rlink') {
                                visitMonsterLink.arlink = e.target.attributes[i].nodeValue;
                            }
                        }

                        caap.clickAjaxLinkSend(visitMonsterLink.arlink);
                    };

                    $j("span[id*='caap_guildmonster_']", caap.caapTopObject).unbind('click', handler).click(handler);

                    state.setItem("GuildMonsterDashUpdate", false);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in guild_monster.dashboard: " + err);
                return false;
            }
        }
        /*jslint sub: false */
    };

    ////////////////////////////////////////////////////////////////////
    //                          festival OBJECT
    // this is the main object for dealing with festival battles
    /////////////////////////////////////////////////////////////////////

    festival = {
        records: [],

        record: function () {
            this.data = {
                'reviewed'    : 0,
                'days'        : 0,
                'tokens'      : 0,
                'tokenTime'   : 0,
                'collect'     : false,
                'startTime'   : 0,
                'ticker'      : '',
                'endTime'     : 0,
                'minions'     : [],
                'teamHealth'  : 0,
                'enemyHealth' : 0,
                'damage'      : 0,
                'myStatus'    : '',
                'myClass'     : '',
                'state'       : '',
                'wins'        : [],
                'losses'      : []
            };
        },

        minion: function () {
            this.data = {
                'index'              : 0,
                'attacking_position' : 0,
                'target_id'          : 0,
                'name'               : '',
                'level'              : 0,
                'mclass'             : '',
                'healthNum'          : 0,
                'healthMax'          : 0,
                'status'             : '',
                'percent'            : 0,
                'points'             : 0,
                'won'                : false,
                'lost'               : false,
                'poly'               : false,
                'shout'              : false,
                'shield'             : false,
                'last_ap'            : 0
            };
        },

        win: function () {
            this.data = {
                'userId' : 0,
                'ap'     : 0
            };
        },

        me: function () {
            this.data = {
                'name'               : '',
                'level'              : 0,
                'mclass'             : '',
                'healthNum'          : 0,
                'healthMax'          : 0,
                'status'             : '',
                'percent'            : 0
            };
        },

        load: function () {
            try {
                festival.records = gm.getItem('festival.records', 'default');
                if (festival.records === 'default' || !$j.isArray(festival.records)) {
                    festival.records = gm.setItem('festival.records', []);
                }

                festival.cleanWins();
                state.setItem("FestivalDashUpdate", true);
                $u.log(3, "festival.load", festival.records);
                return true;
            } catch (err) {
                $u.error("ERROR in festival.load: " + err);
                return false;
            }
        },

        save: function () {
            try {
                gm.setItem('festival.records', festival.records);
                state.setItem("FestivalDashUpdate", true);
                $u.log(3, "festival.save", festival.records);
                return true;
            } catch (err) {
                $u.error("ERROR in festival.save: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        getItem: function () {
            try {
                return (festival.records.length ? festival.records[0] : new festival.record().data);
            } catch (err) {
                $u.error("ERROR in festival.getItem: " + err);
                return false;
            }
        },

        setItem: function (record) {
            try {
                if (!record || !$j.isPlainObject(record)) {
                    throw "Not passed a record";
                }

                festival.records[0] = record;
                $u.log(2, "Updated festival record", record, festival.records);
                festival.save();
                return true;
            } catch (err) {
                $u.error("ERROR in festival.setItem: " + err);
                return false;
            }
        },

        deleteItem: function (slot) {
            try {
                var it        = 0,
                    len       = 0,
                    success   = false;

                if (!$u.isNumber(slot) || slot <= 0) {
                    $u.warn("slot", slot);
                    throw "Invalid identifying slot!";
                }

                for (it = 0, len = festival.records.length; it < len; it += 1) {
                    if (festival.records[it]['slot'] === slot) {
                        success = true;
                        break;
                    }
                }

                if (success) {
                    festival.records.splice(it, 1);
                    festival.save();
                    $u.log(3, "Deleted festival record", slot, festival.records);
                    return true;
                } else {
                    $u.warn("Unable to delete festival record", slot, festival.records);
                    return false;
                }
            } catch (err) {
                $u.error("ERROR in festival.deleteItem: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        clear: function () {
            try {
                $u.log(1, "festival.clear");
                festival.records = gm.setItem("festival.records", []);
                state.setItem('staminaFestival', 0);
                state.setItem('targetFestival', {});
                state.setItem("FestivalDashUpdate", true);
                return true;
            } catch (err) {
                $u.error("ERROR in festival.clear: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        setWin: function (records, won) {
            try {
                if (!records || !$j.isArray(records)) {
                    throw "Not passed records";
                }

                if (!won || !$j.isPlainObject(won)) {
                    throw "Not passed a win";
                }

                if (won['userId'] === '' || $u.isNaN(won['userId']) || won['userId'] < 1) {
                    $u.warn("userId", won['userId']);
                    throw "Invalid identifying userId!";
                }

                var it      = 0,
                    len     = 0,
                    success = false;

                for (it = 0, len = records.length; it < len; it += 1) {
                    if (records[it]['userId'] === won['userId']) {
                        success = true;
                        break;
                    }
                }

                if (success) {
                    records[it] = won;
                    $u.log(3, "Updated records", won, records);
                } else {
                    records.push(won);
                    $u.log(3, "Added records", won, records);
                }

                return records;
            } catch (err) {
                $u.error("ERROR in festival.setWin: " + err, won, records);
                return false;
            }
        },

        getWin: function (records, userId) {
            try {
                if (!records || !$j.isArray(records)) {
                    throw "Not passed records";
                }

                if (userId === '' || $u.isNaN(userId) || userId < 1) {
                    $u.warn("userId", userId);
                    throw "Invalid identifying userId!";
                }

                var it      = 0,
                    len     = 0,
                    success = false;

                for (it = 0, len = records.length; it < len; it += 1) {
                    if (records[it]['userId'] === userId) {
                        success = true;
                        break;
                    }
                }

                if (success) {
                    $u.log(3, "Got win record", userId, records[it]);
                    return records[it];
                } else {
                    $u.log(3, "No win record", userId);
                    return false;
                }
            } catch (err) {
                $u.error("ERROR in festival.getWin: " + err, userId, records);
                return false;
            }
        },

        delWin: function (records, userId) {
            try {
                if (!records || !$j.isArray(records)) {
                    throw "Not passed records";
                }

                if (userId === '' || $u.isNaN(userId) || userId < 1) {
                    $u.warn("userId", userId);
                    throw "Invalid identifying userId!";
                }

                var it      = 0,
                    len     = 0,
                    success = false;

                for (it = 0, len = records.length; it < len; it += 1) {
                    if (records[it]['userId'] === userId) {
                        success = true;
                        break;
                    }
                }

                if (success) {
                    records.splice(it, 1);
                    $u.log(2, "Deleted win record", userId, records);
                    return records;
                } else {
                    $u.log(3, "Unable to delete win record", userId, records);
                    return false;
                }
            } catch (err) {
                $u.error("ERROR in festival.delWin: " + err, userId, records);
                return false;
            }
        },

        setLoss: function (records, userId) {
            try {
                if (!records || !$j.isArray(records)) {
                    throw "Not passed records";
                }

                if (userId === '' || $u.isNaN(userId) || userId < 1) {
                    $u.warn("userId", userId);
                    throw "Invalid identifying userId!";
                }

                if (records.hasIndexOf(userId)) {
                    $u.log(3, "userId exists", userId, records);
                } else {
                    records.push(userId);
                    $u.log(3, "Added userId", userId, records);
                }

                return records;
            } catch (err) {
                $u.error("ERROR in festival.setLoss: " + err, userId, records);
                return false;
            }
        },

        checkLoss: function (records, userId) {
            try {
                if (!records || !$j.isArray(records)) {
                    throw "Not passed records";
                }

                if (userId === '' || $u.isNaN(userId) || userId < 1) {
                    $u.warn("userId", userId);
                    throw "Invalid identifying userId!";
                }

                if (records.hasIndexOf(userId)) {
                    $u.log(3, "userId exists", userId, records);
                    return true;
                } else {
                    $u.log(3, "userId not exists", userId, records);
                    return false;
                }
            } catch (err) {
                $u.error("ERROR in festival.checkLoss: " + err, userId, records);
                return undefined;
            }
        },

        delLoss: function (records, userId) {
            try {
                if (!records || !$j.isArray(records)) {
                    throw "Not passed records";
                }

                if (userId === '' || $u.isNaN(userId) || userId < 1) {
                    $u.warn("userId", userId);
                    throw "Invalid identifying userId!";
                }

                var it = -1;
                it = records.indexOf(userId);
                if (it >= 0) {
                    records.splice(it, 1);
                    $u.log(2, "Deleted loss", userId, records);
                    return records;
                } else {
                    $u.log(3, "Unable to delete loss", userId, records);
                    return false;
                }
            } catch (err) {
                $u.error("ERROR in festival.delLoss: " + err, userId, records);
                return false;
            }
        },

        cleanWins: function () {
            try {
                var festivalInfo = {},
                    it        = 0,
                    len       = 0,
                    found     = false;

                festivalInfo = festival.getItem();
                if (!$j.isEmptyObject(festivalInfo)) {
                    for (it = 0, len = festivalInfo['wins'].length; it < len; it += 1) {
                        if (festivalInfo['losses'].hasIndexOf(festivalInfo['wins'][it]['userId'])) {
                            $u.log(1, "Found win in losses: delete", festivalInfo['wins'][it]);
                            festivalInfo['wins'].splice(it, 1);
                            found = true;
                        }
                    }
                } else {
                    $u.log(1, "No loss records available", festivalInfo);
                }

                if (found) {
                    festival.setItem(festivalInfo);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in festival.cleanWins: " + err);
                return false;
            }
        },

        /*jslint sub: false */

        navigate_to_main: function () {
            return caap.navigateTo('soldiers,tab_festival_off.jpg,festival_battle_home', 'arena3_rewardsbutton.gif');
        },

        navigate_to_main_refresh: function () {
            state.setItem('FestivalRefresh', false);
            return caap.navigateTo('soldiers,tab_festival_off.jpg,festival_battle_home');
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checkInfo: function () {
            try {
                var infoDiv      = $j("#current_battle_info", caap.appBodyDiv),
                    now          = new Date(),
                    tDate        = new Date(),
                    next         = $u.setContent(infoDiv.children().eq(0).children().eq(0).text(), '').trim().innerTrim(),
                    timer        = $u.setContent(infoDiv.children().eq(1).children().eq(0).text(), '').trim().innerTrim(),
                    tz           = $u.setContent(timer.regex(/UTC ([\-+]*?\d+);/), 0),
                    ampm         = $u.setContent(timer.regex(/\d+:\d+ (AM|PM)/), 'AM'),
                    hour         = $u.setContent(timer.regex(/(\d+):\d+/), 0),
                    festivalInfo = festival.getItem(),
                    start        = 0;

                hour = ampm === 'AM' && hour === 12 ? 0 : (ampm === 'PM' ? hour + 12 : hour);
                hour = tz === 0 ? hour : hour - tz;
                hour = hour < 0 ? hour + 24 : (hour > 24 ? hour - 24 : hour);
                tDate.setUTCHours(hour, 0, 0, 0);
                tDate.setUTCDate(tDate.getDate() + (tDate < now ? 1 : 0));
                festivalInfo['reviewed'] = now.getTime();
                $u.log(2, "festival.checkInfo", next, timer, hour, tz);
                $u.log(2, "When", tDate.toUTCString());

                if (festivalInfo['endTime'] < festivalInfo['reviewed']) {
                    festivalInfo['startTime'] = tDate.getTime();
                    festivalInfo['endTime'] = festivalInfo['startTime'] + 3600000;
                    schedule.setItem('festivalStartTime', festivalInfo['startTime'], 20);
                    $u.log(2, "New start time");
                }

                festivalInfo['collect'] = next.regex(/(COLLECT NOW!)/) ? true : false;
                if (festivalInfo['state'] === '' || festivalInfo['state'] === 'Completed') {
                    schedule.setItem("festivalTokenTicker", 0);
                    festivalInfo['state'] = 'Ready';
                    festivalInfo['tokens'] = 10;
                    festivalInfo['myStatus'] = '';
                    festivalInfo['damage'] = 0;
                    festivalInfo['teamHealth'] = 0;
                    festivalInfo['enemyHealth'] = 0;
                    festivalInfo['ticker'] = '';
                }

                festival.setItem(festivalInfo);
                start = festivalInfo['startTime'] - festivalInfo['reviewed'];
                start = start > 0 ? start : 0;
                if (start && festivalInfo['state'] === 'Ready') {
                    festivalInfo['minions'] = [];
                    $u.log(2, "Festival starting in", start);
                    schedule.setItem("FestivalReview", start, 20);
                } else {
                    $u.log(2, "Festival review in", 300);
                    schedule.setItem("FestivalReview", 300, 20);
                }

                $u.log(3, "festival.checkInfo", festivalInfo);
                return true;
            } catch (err) {
                $u.error("ERROR in festival.checkInfo: " + err);
                return false;
            }
        },

        onBattle: function () {
            try {
                var gates         = $j(),
                    tabs          = $j(),
                    health        = $j(),
                    healthGuild   = $j(),
                    healthEnemy   = $j(),
                    bannerDiv     = $j(),
                    collectDiv    = $j(),
                    enterDiv      = $j(),
                    tokenSpan     = $j(),
                    timerSpan     = $j(),
                    resultBody    = $j(),
                    imgDiv        = $j(),
                    myStatsTxt    = '',
                    myStatsArr    = [],
                    index         = 0,
                    currentRecord = {},
                    minions       = [],
                    tStr          = '',
                    tNum          = 0,
                    resultsTxt    = '',
                    lastAttacked  = {},
                    won           = {},
                    losses        = [],
                    wins          = [],
                    notStarted    = '',
                    notFestival      = '',
                    battleOver    = '',
                    minionRegEx   = new RegExp("(.*) Level: (\\d+) Class: (.*) Health: (\\d+)/(\\d+) Status: (.*) Festival Activity Points: (\\d+)");

                currentRecord = festival.getItem();
                if (currentRecord['state'] !== 'Alive') {
                    $u.log(2, "Test targeting");
                    festival.getTargetMinion(currentRecord);
                }

                if (!currentRecord['wins']) {
                    currentRecord['wins'] = [];
                }

                if (!currentRecord['losses']) {
                    currentRecord['losses'] = [];
                }

                if (!currentRecord['myClass']) {
                    currentRecord['myClass'] = '';
                }

                lastAttacked = state.getItem('FestivalMinionAttacked', {});
                state.setItem('FestivalMinionAttacked', {});
                if (!$j.isEmptyObject(lastAttacked) && lastAttacked['index'] >= 0 && lastAttacked['index'] < 40) {
                    resultBody = $j("span[class='result_body']", caap.globalContainer);
                    if ($u.hasContent(resultBody)) {
                        tStr = resultBody.text();
                        tNum = tStr ? tStr.regex(/\+(\d+) Battle Activity Points/) : 0;
                    }

                    imgDiv = $j("img[src*='battle_defeat.gif']", caap.globalContainer);
                    if ($u.hasContent(imgDiv)) {
                        if (lastAttacked['poly']) {
                            $u.log(1, "Defeated by polymorphed minion", tNum, currentRecord['minions'][lastAttacked['index']]);
                        } else {
                            if (tNum > 50) {
                                currentRecord['minions'][lastAttacked['index']]['lost'] = true;
                                currentRecord['minions'][lastAttacked['index']]['won'] = false;
                                currentRecord['minions'][lastAttacked['index']]['last_ap'] = 0;
                                wins = festival.delWin(currentRecord['wins'], currentRecord['minions'][lastAttacked['index']]['target_id']);
                                currentRecord['wins'] = wins ? wins : currentRecord['wins'];
                                losses = festival.setLoss(currentRecord['losses'], currentRecord['minions'][lastAttacked['index']]['target_id']);
                                currentRecord['losses'] = losses ? losses : currentRecord['losses'];
                                festival.setItem(currentRecord);
                            } else {
                                $u.log(1, "You were polymorphed");
                            }

                            $u.log(1, "Defeated by minion", tNum, currentRecord['minions'][lastAttacked['index']]);
                        }
                    } else {
                        imgDiv = $j("img[src*='battle_victory.gif']", caap.globalContainer);
                        if ($u.hasContent(imgDiv)) {
                            if (lastAttacked['poly']) {
                                $u.log(1, "Victory against polymorphed minion", tNum, currentRecord['minions'][lastAttacked['index']]);
                            } else {
                                currentRecord['minions'][lastAttacked['index']]['lost'] = false;
                                currentRecord['minions'][lastAttacked['index']]['won'] = true;
                                currentRecord['minions'][lastAttacked['index']]['last_ap'] = tNum ? tNum : 160;
                                won = new festival.win();
                                won.data['userId'] = currentRecord['minions'][lastAttacked['index']]['target_id'];
                                won.data['ap'] = currentRecord['minions'][lastAttacked['index']]['last_ap'];
                                wins = festival.setWin(currentRecord['wins'], won.data);
                                currentRecord['wins'] = wins ? wins : currentRecord['wins'];
                                losses = festival.delLoss(currentRecord['losses'], currentRecord['minions'][lastAttacked['index']]['target_id']);
                                currentRecord['losses'] = losses ? losses : currentRecord['losses'];
                                festival.setItem(currentRecord);
                                $u.log(1, "Victory against minion", tNum, currentRecord['minions'][lastAttacked['index']]);
                            }
                        } else {
                            resultsTxt = $j("div[class='results']", caap.globalContainer).text();
                            if (resultsTxt.regex(/(You do not have enough battle tokens for this action)/i)) {
                                $u.log(1, "You didn't have enough battle tokens");
                            } else if (resultsTxt.regex(/(does not have any health left to battle)/i)) {
                                $u.log(1, "Minion had no health left");
                            } else if (resultsTxt.regex(/(You tried to attack but tripped while running)/i)) {
                                $u.log(1, "Oops, you tripped");
                            } else {
                                $u.log(1, "Unknown win or loss or result");
                            }
                        }
                    }
                }

                bannerDiv = $j("#" +  caap.domain.id[caap.domain.which] + "arena_battle_banner_section", caap.globalContainer);
                $u.log(2, "arena_battle_banner_section");
                myStatsTxt = bannerDiv.text();
                myStatsTxt = myStatsTxt ? myStatsTxt.trim().innerTrim() : '';
                notStarted = myStatsTxt.regex(/(This Battle Has Not Started Yet)/);
                notFestival = myStatsTxt.regex(/(You Are Not A Part Of This Festival Battle)/);
                battleOver = myStatsTxt.regex(/(This Festival Battle Is Over)/);
                if (notFestival) {
                    return true;
                }

                $u.log(3, "myStatsTxt", myStatsTxt);
                if ($u.hasContent(bannerDiv)) {
                    currentRecord['teamHealth'] = 0;
                    currentRecord['enemyHealth'] = 0;
                    if (!notStarted) {
                        gates = $j("div[id*='" +  caap.domain.id[caap.domain.which] + "enemy_guild_member_list_']", caap.globalContainer);
                        if (!$u.hasContent(gates)) {
                            tabs = $j("div[id*='" +  caap.domain.id[caap.domain.which] + "your_arena_tab']", caap.globalContainer);
                            if (!$u.hasContent(tabs)) {
                                $u.warn("No gates found");
                            }
                        } else if (!$u.hasContent(gates) || gates.length !== 4) {
                            $u.warn("Not enough gates found");
                        } else {
                            gates.each(function (gIndex) {
                                var memberDivs = $j(this).children();
                                if (!$u.hasContent(memberDivs)) {
                                    $u.warn("No members found");
                                } else {
                                    if (memberDivs.length === 1 && /No Soldiers Posted In This Position!/i.test(memberDivs.text().trim().innerTrim())) {
                                        $u.log(2, "No Soldiers Posted In This Position");
                                        return true;
                                    }

                                    memberDivs.each(function (mIndex) {
                                        var member       = $j(this),
                                            memberText   = '',
                                            memberArr    = [],
                                            targetIdDiv  = $j(),
                                            polyImg      = $j(),
                                            shoutImg     = $j(),
                                            shieldImg    = $j(),
                                            nameDiv      = $j(),
                                            loss         = false,
                                            memberRecord = new festival.minion().data;

                                        memberRecord['index'] = index;
                                        targetIdDiv = $j("input[name='target_id']", member);
                                        if ($u.hasContent(targetIdDiv)) {
                                            memberRecord['target_id'] = targetIdDiv.attr("value") ? targetIdDiv.attr("value").parseInt() : 0;
                                            won = festival.getWin(currentRecord['wins'], memberRecord['target_id']);
                                            if ($j.isPlainObject(won)) {
                                                memberRecord['won'] = true;
                                                memberRecord['last_ap'] = won['ap'] ? won['ap'] : 0;
                                            }

                                            loss = festival.checkLoss(currentRecord['losses'], memberRecord['target_id']);
                                            if ($u.isBoolean(loss)) {
                                                memberRecord['lost'] = loss;
                                            }
                                        } else {
                                            $u.warn("Unable to find target_id for minion!", targetIdDiv.length);
                                        }

                                        memberRecord['attacking_position'] = (gIndex + 1);
                                        memberText = member.children().eq(1).text();
                                        memberText = memberText ? memberText.trim().innerTrim() : '';
                                        $u.log(2, "memberText", memberText);
                                        memberArr = memberText.match(minionRegEx);
                                        if ($u.hasContent(memberArr) && memberArr.length === 8) {
                                            memberRecord['name'] = memberArr[1] ? memberArr[1] : '';
                                            memberRecord['level'] = memberArr[2] ? memberArr[2].parseInt() : 0;
                                            memberRecord['mclass'] = memberArr[3] ? memberArr[3] : '';
                                            memberRecord['healthNum'] = memberArr[4] ? memberArr[4].parseInt() : 0;
                                            memberRecord['healthMax'] = memberArr[5] ? memberArr[5].parseInt() : 0;
                                            memberRecord['status'] = memberArr[6] ? memberArr[6] : '';
                                            memberRecord['points'] = memberArr[7] ? memberArr[7].parseInt() : 0;
                                            memberRecord['percent'] = ((memberRecord['healthNum'] / (memberRecord['healthMax'] ? memberRecord['healthMax'] : 1)) * 100).dp(2);
                                        } else {
                                            $u.warn("Minion match issue!", memberArr);
                                        }

                                        if (currentRecord['minions'] && currentRecord['minions'].length === 40) {
                                            if (currentRecord['minions'][index]['index'] === index) {
                                                memberRecord['lost'] = currentRecord['minions'][index]['lost'] ? currentRecord['minions'][index]['lost'] : false;
                                                memberRecord['last_ap'] = currentRecord['minions'][index]['last_ap'] ? currentRecord['minions'][index]['last_ap'] : 0;
                                            } else {
                                                $u.warn("Minion index issue!", index, currentRecord['minions'][index], memberRecord);
                                            }
                                        }

                                        nameDiv = $j("div[style='font-size: 19px; padding-bottom: 3px;'], div[style='font-size:19px; padding-bottom:3px;']", member);
                                        if ($u.hasContent(nameDiv) && nameDiv.length === 1) {
                                            if (memberRecord['won']) {
                                                tStr = '<div style="float: left; width: 220px; font-size: 11px;"><span style="float: left;" title="Won - Last Points: ' + memberRecord['last_ap'];
                                                tStr += '" class="ui-icon ui-icon-circle-check">Won</span> Last Points: ' + memberRecord['last_ap'] + '</div>';
                                                nameDiv.after(tStr);
                                            }

                                            if (memberRecord['lost']) {
                                                tStr = '<div style="float: left; width: 220px; font-size: 11px;"><span style="float: left;" title="Lost" class="ui-icon ui-icon-circle-close">Lost</span>Lost</div>';
                                                nameDiv.after(tStr);
                                            }
                                        }

                                        polyImg = $j("img[src*='polymorph_effect']", member);
                                        memberRecord['poly'] = $u.hasContent(polyImg) ? true : false;
                                        if (memberRecord['poly']) {
                                            $u.log(3, "poly", memberRecord);
                                        }

                                        shoutImg = $j("img[src*='warrior_effect_shout']", member);
                                        memberRecord['shout'] = $u.hasContent(shoutImg) ? true : false;
                                        if (memberRecord['shout']) {
                                            $u.log(2, "shout", memberRecord);
                                        }

                                        shieldImg = $j("img[src*='mage_effect_shield']", member);
                                        memberRecord['shield'] = $u.hasContent(shieldImg) ? true : false;
                                        if (memberRecord['shield']) {
                                            $u.log(2, "shield", memberRecord);
                                        }

                                        index = minions.push(memberRecord);
                                    });
                                }

                                return true;
                            });
                        }
                    }

                    collectDiv = $j("input[src*='arena3_collectbutton.gif']", caap.globalContainer);
                    enterDiv = $j("input[src*='guild_enter_battle_button.gif']", caap.globalContainer);
                    if (!notStarted && !battleOver && !$u.hasContent(collectDiv) && !$u.hasContent(enterDiv)) {
                        currentRecord['state'] = 'Alive';
                        tStr = $j("span[id='" +  caap.domain.id[caap.domain.which] + "monsterTicker']", caap.globalContainer).text();
                        currentRecord['ticker'] = tStr ? tStr.trim() : '';
                        schedule.setItem("festivalTokenTicker", currentRecord['ticker'].parseTimer(), 5);
                        if (myStatsTxt) {
                            $u.log(3, "myStatsTxt", myStatsTxt);
                            myStatsArr = myStatsTxt.match(new RegExp("(.+) Level: (\\d+) Class: (.+) Health: (\\d+)/(\\d+).+Status: (.+) Festival Activity Points: (\\d+)"));
                            if ($u.hasContent(myStatsArr) && myStatsArr.length === 8) {
                                $u.log(3, "myStatsArr", myStatsArr);
                                currentRecord['damage'] = myStatsArr[7] ? myStatsArr[7].parseInt() : 0;
                                currentRecord['myStatus'] = myStatsArr[6] ? myStatsArr[6].trim() : '';
                                currentRecord['myClass'] = myStatsArr[3] ? myStatsArr[3].trim() : '';
                            } else {
                                $u.warn("myStatsArr error", myStatsArr, myStatsTxt);
                            }
                        }

                        tokenSpan = $j("span[id='" +  caap.domain.id[caap.domain.which] + "guild_token_current_value']", caap.globalContainer);
                        tStr = $u.hasContent(tokenSpan) ? tokenSpan.text().trim() : '';
                        currentRecord['tokens'] = tStr ? tStr.parseInt() : 0;

                        timerSpan = $j("span[id='" +  caap.domain.id[caap.domain.which] + "guild_token_time_value']", caap.globalContainer);
                        tStr = $u.hasContent(timerSpan) ? timerSpan.text().trim() : '';
                        currentRecord['tokenTime'] = tStr ? tStr.regex(/(\d+:\d+)/) : '0:00';

                        health = $j("#" +  caap.domain.id[caap.domain.which] + "guild_battle_health", caap.globalContainer);
                        if ($u.hasContent(health)) {
                            healthEnemy = $j("div[style*='guild_battle_bar_enemy.gif']", health).eq(0);
                            if ($u.hasContent(healthEnemy)) {
                                currentRecord['enemyHealth'] = (100 - healthEnemy.getPercent('width')).dp(2);
                            } else {
                                $u.warn("guild_battle_bar_enemy.gif not found");
                            }

                            healthGuild = $j("div[style*='guild_battle_bar_you.gif']", health).eq(0);
                            if ($u.hasContent(healthGuild)) {
                                currentRecord['teamHealth'] = (100 - healthGuild.getPercent('width')).dp(2);
                            } else {
                                $u.warn("guild_battle_bar_you.gif not found");
                            }
                        } else {
                            $u.warn("guild_battle_health error");
                        }
                    } else {
                        if ($u.hasContent(collectDiv)) {
                            $u.log(1, "Battle ready to collect");
                            currentRecord['state'] = 'Collect';
                        } else if (!$u.hasContent(enterDiv) && currentRecord['state'] !== 'Ready') {
                            $u.log(1, "Battle is completed");
                            currentRecord['state'] = 'Completed';
                        } else {
                            $u.log(1, "Battle is ready to join");
                            currentRecord['state'] = 'Ready';
                        }

                        currentRecord['myStatus'] = '';
                        currentRecord['damage'] = 0;
                        currentRecord['teamHealth'] = 0;
                        currentRecord['enemyHealth'] = 0;
                    }

                    if ($u.hasContent(minions)) {
                        currentRecord['minions'] = minions.slice();
                    }

                    currentRecord['reviewed'] = new Date().getTime();
                    $u.log(3, "currentRecord", currentRecord);
                    festival.setItem(currentRecord);
                    if (currentRecord['state'] === 'Collect' && $u.hasContent(collectDiv)) {
                        caap.click(collectDiv);
                    }
                } else {
                    $u.warn("Not on festival battle page");
                }

                return true;
            } catch (err) {
                $u.error("ERROR in festival.onBattle: " + err);
                return false;
            }
        },

        clearMinions: function () {
            try {
                var currentRecord = {};
                currentRecord = festival.getItem();
                currentRecord['minions'] = [];
                festival.setItem(currentRecord);
                return true;
            } catch (err) {
                $u.error("ERROR in festival.clearMinions: " + err);
                return false;
            }
        },

        getMinion: function (index) {
            try {
                var festivalInfo = {},
                    minion    = {};

                if (index === '' || $u.isNaN(index) || index < 0 || index > 40) {
                    $u.warn("index", index);
                    throw "Invalid identifying index!";
                }

                festivalInfo = festival.getItem();
                if (!$j.isEmptyObject(festivalInfo) && festivalInfo['minions'] && festivalInfo['minions'].length === 40) {
                    minion = festivalInfo['minions'][index];
                } else {
                    $u.log(1, "No minion records available", festivalInfo);
                }

                return minion;
            } catch (err) {
                $u.error("ERROR in festival.getTarget: " + err);
                return false;
            }
        },

        getTargetMinion: function (record) {
            try {
                var it              = 0,
                    ot              = 0,
                    lenIt           = 0,
                    lenOt           = 0,
                    target = {
                        'Cleric' : {
                            'last'    : {},
                            'suicide' : {},
                            'active'  : {},
                            'alive'   : {},
                            'health'  : {},
                            'poly'    : {},
                            'shout'   : {},
                            'chain'   : {}
                        },
                        'Mage' : {
                            'last'    : {},
                            'suicide' : {},
                            'active'  : {},
                            'alive'   : {},
                            'health'  : {},
                            'poly'    : {},
                            'shout'   : {},
                            'chain'   : {}
                        },
                        'Rogue' : {
                            'last'    : {},
                            'suicide' : {},
                            'active'  : {},
                            'alive'   : {},
                            'health'  : {},
                            'poly'    : {},
                            'shout'   : {},
                            'chain'   : {}
                        },
                        'Warrior' : {
                            'last'    : {},
                            'suicide' : {},
                            'active'  : {},
                            'alive'   : {},
                            'health'  : {},
                            'poly'    : {},
                            'shout'   : {},
                            'chain'   : {}
                        }
                    },
                    minion            = {},
                    killClericFirst   = false,
                    attackPoly        = false,
                    ignoreFestivalHealth = 0,
                    maxFestivalLevel     = 0,
                    chainFestival        = 0,
                    observeHealth     = false,
                    attackSuicide     = false,
                    chainStrict       = false,
                    doPoly            = false,
                    stunnedPoly       = false,
                    roguePoly         = false,
                    attackOrderList   = [],
                    defaultOrderList  = [],
                    typeOrderList     = [],
                    done              = false,
                    uOrder            = '',
                    oType             = '';

                if (!record || !$j.isPlainObject(record)) {
                    throw "Not passed a record";
                }

                ignoreFestivalHealth = config.getItem("ignoreFestivalHealth", 200);
                maxFestivalLevel = config.getItem("maxFestivalLevel", 50);
                killClericFirst = config.getItem("killClericFirst", false);
                attackPoly = config.getItem("attackPoly", false);
                chainFestival = config.getItem("chainFestival", '160').parseInt();
                observeHealth = config.getItem("observeHealth", true);
                attackSuicide = config.getItem("attackSuicide", false);
                chainStrict = config.getItem("chainStrict", false);
                doPoly = config.getItem("doPoly", false);
                stunnedPoly = config.getItem("stunnedPoly", true);
                roguePoly = config.getItem("roguePoly", true);
                function targetThis(next, type) {
                    try {
                        var nDiff   = 0,
                            cDiff   = 0,
                            higherLevel  = false,
                            lowerLevel = false,
                            knownWin = false,
                            clericMage = false,
                            shieldShout = false,
                            ignorePoly = false,
                            logic1  = false,
                            logic2  = false,
                            logic3  = false,
                            logic4  = false,
                            logic5  = false,
                            mclass  = '';

                        mclass = next['mclass'];
                        higherLevel = next['level'] > (target[mclass][type]['level'] ? target[mclass][type]['level'] : 0);
                        lowerLevel = next['level'] < (target[mclass][type]['level'] ? target[mclass][type]['level'] : 99999);
                        knownWin = next['won'] && !(target[mclass][type]['won'] ? target[mclass][type]['won'] : false);
                        clericMage = mclass === "Cleric" || mclass === "Mage";
                        shieldShout = next['shield'] || next['shout'];
                        logic1 = ((killClericFirst && mclass === "Cleric") || next['healthNum'] > ignoreFestivalHealth);
                        logic2 = !doPoly && next['poly'];
                        logic3 = doPoly && stunnedPoly && next['poly'] && record['myStatus'] === 'Stunned';
                        logic4 = doPoly && roguePoly && next['poly'] && record['myClass'] !== 'Rogue';
                        logic5 = doPoly && next['poly'] && next['healthNum'] <= 50;
                        ignorePoly = logic2 || logic3 || logic4 || logic5;

                        switch (type) {
                        case "health":
                            if (ignorePoly) {
                                $u.log(2, "Ignoring polymorphed minion " + mclass + " " + type, record['myStatus'], next);
                                return false;
                            }

                            if (!(logic1 && !shieldShout)) {
                                return false;
                            }

                            break;
                        case "active":
                            if (ignorePoly) {
                                $u.log(2, "Ignoring polymorphed minion " + mclass + " " + type, record['myStatus'], next);
                                return false;
                            }

                            if (!(logic1 && next['points'] && !shieldShout)) {
                                return false;
                            }

                            break;
                        case "suicide":
                            logic2 = next['healthNum'] < (target[mclass][type]['healthNum'] ? target[mclass][type]['healthNum'] : 99999);
                            logic3 = !clericMage && logic1 && next['points'] && logic2;
                            if (logic3 && !shieldShout && lowerLevel) {
                                target[mclass][type] = next;
                                return true;
                            } else {
                                return false;
                            }

                            break;
                        case "last":
                            logic2 = $j.isEmptyObject(target[mclass][type]) && clericMage && next['healthNum'] > 0 && next['healthNum'] <= 30;
                            if (logic2 && !shieldShout) {
                                target[mclass][type] = next;
                                return true;
                            }

                            logic3 = !clericMage && target[mclass][type]['mclass'] !== 'Cleric' && (target[mclass][type]['mclass'] ? target[mclass][type]['mclass'] : 'none') !== 'mage';
                            logic4 = logic3 && next['healthNum'] > 200 && next['healthNum'] < (target[mclass][type]['healthNum'] ? target[mclass][type]['healthNum'] : 0);
                            if (logic4 && !shieldShout && lowerLevel) {
                                target[mclass][type] = next;
                                return true;
                            }

                            logic5 = $j.isEmptyObject(target[mclass][type]) && logic3 && next['healthNum'] > (target[mclass][type]['healthNum'] ? target[mclass][type]['healthNum'] : 0);
                            if (logic5 && !shieldShout) {
                                target[mclass][type] = next;
                                return true;
                            } else {
                                return false;
                            }

                            break;
                        case "poly":
                            if (ignorePoly) {
                                $u.log(2, "Ignoring polymorphed minion " + mclass + " " + type, record['myStatus'], next);
                                return false;
                            }

                            if (next['poly'] && (shieldShout || higherLevel)) {
                                target[mclass][type] = next;
                                return true;
                            } else {
                                return false;
                            }

                            break;
                        case "chain":
                            logic2 = chainFestival && next['won'] && next['last_ap'] >= chainFestival;
                            logic3 = !observeHealth && logic2;
                            logic4 = observeHealth && logic1 && logic2;
                            logic5 = logic3 || logic4;

                            if (logic5 && higherLevel && next['last_ap'] >= (target[mclass][type]['last_ap'] ? target[mclass][type]['last_ap'] : 0)) {
                                target[mclass][type] = next;
                                return true;
                            } else {
                                return false;
                            }

                            break;
                        default:
                        }

                        nDiff = next['level'] - caap.stats['level'];
                        cDiff = target[mclass][type]['level'] ? target[mclass][type]['level'] - caap.stats['level'] : 0 - caap.stats['level'];
                        if (cDiff !== 0) {
                            if (cDiff > 0) {
                                if (nDiff >= 0 && nDiff <= maxFestivalLevel && nDiff > cDiff) {
                                    $u.log(3, type + ' ' + mclass + " better level match", target[mclass][type]['level'], next['level'], [target[mclass][type], next]);
                                    target[mclass][type] = next;
                                    return true;
                                }

                                if (nDiff > maxFestivalLevel && nDiff < cDiff) {
                                    $u.log(3, type + ' ' + mclass + " better level match", target[mclass][type]['level'], next['level'], [target[mclass][type], next]);
                                    target[mclass][type] = next;
                                    return true;
                                }
                            } else {
                                if (nDiff <= maxFestivalLevel && nDiff > cDiff) {
                                    $u.log(3, type + ' ' + mclass + " better level match", target[mclass][type]['level'], next['level'], [target[mclass][type], next]);
                                    target[mclass][type] = next;
                                    return true;
                                }
                            }
                        }

                        return false;
                    } catch (e) {
                        $u.warn("targetThis", next);
                        return false;
                    }
                }

                for (it = record['minions'].length - 1; it >= 0; it -= 1) {
                    var cm = {};

                    cm = record['minions'][it];
                    if (cm['status'] === 'Stunned' && cm['healthNum'] <= 0) {
                        $u.log(2, "Stunned minion", cm['index'], cm);
                        continue;
                    }

                    targetThis(cm, 'last');
                    targetThis(cm, 'poly');
                    if (cm['lost']) {
                        $u.log(2, "Lost minion", cm['index'], cm);
                        targetThis(cm, 'suicide');
                        continue;
                    }

                    targetThis(cm, 'active');
                    targetThis(cm, 'alive');
                    targetThis(cm, 'health');
                    targetThis(cm, 'chain');
                }

                defaultOrderList = ['Cleric', 'Mage', 'Rogue', 'Warrior'];
                attackOrderList = config.getList('orderFestivalClass', '');
                if (!attackOrderList || attackOrderList.length === 0) {
                    attackOrderList = defaultOrderList.slice();
                }

                $u.log(3, "attackOrderList", attackOrderList);
                typeOrderList = ['chain', 'active', 'health', 'alive', 'last'];
                if (attackSuicide) {
                    typeOrderList.splice(3, 0, 'suicide');
                }

                if (attackPoly) {
                    typeOrderList.unshift('poly');
                } else {
                    typeOrderList.splice(1, 0, 'poly');
                }

                $u.log(3, "typeOrderList", typeOrderList);
                for (it = 0, lenIt = typeOrderList.length; it < lenIt; it += 1) {
                    if (done) {
                        break;
                    }

                    oType = typeOrderList[it];
                    $u.log(3, "oType", oType);
                    for (ot = 0, lenOt = attackOrderList.length; ot < lenOt; ot += 1) {
                        uOrder = attackOrderList[ot].toString().toLowerCase().ucFirst();
                        $u.log(3, "uOrder", uOrder);
                        if (!defaultOrderList.hasIndexOf(uOrder)) {
                            continue;
                        }

                        if (!$j.isEmptyObject(target[uOrder][oType])) {
                            minion = target[uOrder][oType];
                            $u.log(3, "done", uOrder, oType);
                            done = true;
                            break;
                        }
                    }
                }

                if ($j.isEmptyObject(minion)) {
                    $u.warn("No target found!");
                } else {
                    $u.log(1, "Target " + minion['mclass'] + " " + oType, minion['index'], minion, target);
                }

                return minion;
            } catch (err) {
                $u.error("ERROR in festival.getTargetMinion: " + err);
                return undefined;
            }
        },

        menu: function () {
            try {
                var mbattleList = [
                        'Tokens Available',
                        'Never'
                    ],
                    mbattleInst = [
                        'Tokens Available will attack whenever you have enough tokens',
                        'Never - disables attacking in Festival'
                    ],
                    chainList = [
                        '0',
                        '160',
                        '200',
                        '240'
                    ],
                    chainListInst = [
                        'Disabled',
                        'Chain 160 and above',
                        'Chain 200 and above',
                        'Chain 240 and above'
                    ],
                    htmlCode = '';

                htmlCode += caap.startToggle('Festival', 'FESTIVAL');
                htmlCode += caap.makeDropDownTR("Attack When", 'WhenFestival', mbattleList, mbattleInst, '', 'Never', false, false, 62);
                htmlCode += caap.startDropHide('WhenFestival', '', 'Never', true);
                htmlCode += caap.makeTD("Attack Classes in this order");
                htmlCode += caap.makeTextBox('orderFestivalClass', 'Attack Festival class in this order. Uses the class name.', 'Cleric,Mage,Rogue,Warrior', '');
                htmlCode += caap.makeNumberFormTR("Ignore Health &lt;=", 'ignoreFestivalHealth', "Ignore enemies with health equal to or below this level.", 200, '', '');
                htmlCode += caap.makeNumberFormTR("Ignore Level Plus &gt;=", 'maxFestivalLevel', "This value is added the the value of your current level and enemies with a level above this value are ignored", 50, '', '');
                htmlCode += caap.makeCheckTR("Stun All Clerics", 'killClericFirst', false, "Attack Clerics that are not stunned.");
                htmlCode += caap.makeCheckTR("Do Polymorphed", 'doPoly', true, "Attack polymorphed players.");
                htmlCode += caap.startCheckHide('doPoly');
                htmlCode += caap.makeCheckTR("Priority Polymorphed", 'attackPoly', false, "Attack polymorphed players first.", true);
                htmlCode += caap.makeCheckTR("Attack Polymorphed If Rogue", 'roguePoly', true, "Only attack polymorphed players if you are class Rogue.", true);
                htmlCode += caap.makeCheckTR("Stunned Ignore Polymorphed", 'stunnedPoly', true, "If you are stunned then don't attack polymorphed minions, leave them for someone who can do more damage.", true);
                htmlCode += caap.endCheckHide('doPoly');
                htmlCode += caap.makeCheckTR("Suicide", 'attackSuicide', false, "When out of targets, attack active Rogues or Warriors to which you lost previously, before any class that's not stunned.");
                htmlCode += caap.makeDropDownTR("Chain", 'chainFestival', chainList, chainListInst, '', '160', false, false, 35);
                htmlCode += caap.startDropHide('chainFestival', '', '0', true);
                htmlCode += caap.makeCheckTR("Chain Observe Health", 'observeHealth', true, "When chaining, observe the 'Ignore Health' and 'Stun All Clerics' options.");
                htmlCode += caap.endDropHide('chainFestival');
                htmlCode += caap.endDropHide('WhenFestival');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in festival.menu: " + err);
                return '';
            }
        },

        dashboard: function () {
            try {
                if (config.getItem('DBDisplay', '') === 'Festival' && state.getItem("FestivalDashUpdate", true)) {
                    var headers = ['Festival', 'Damage',     'Team%',       'Enemy%',   'My Status', 'TimeLeft', 'Status'],
                        values  = ['damage',   'teamHealth', 'enemyHealth', 'myStatus', 'ticker',    'state'],
                        pp      = 0,
                        i       = 0,
                        len     = 0,
                        data    = {},
                        color   = '',
                        handler = null,
                        head    = '',
                        body    = '',
                        row     = '';

                    for (pp = 0; pp < headers.length; pp += 1) {
                        head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: ''});
                    }

                    head = caap.makeTr(head);
                    for (i = 0, len = festival.records.length; i < len; i += 1) {
                        row = "";
                        data = {
                            text  : '<span id="caap_festival_1" title="Clicking this link will take you to the Festival" rlink="festival_battle_home.php" onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';">Festival</span>',
                            color : 'blue',
                            id    : '',
                            title : ''
                        };

                        row += caap.makeTd(data);
                        color = festival.records[i]['state'] === 'Alive' ? 'green' : $u.bestTextColor(config.getItem("StyleBackgroundLight", "#E0C961"));
                        color = festival.records[i]['state'] === 'Alive' && festival.records[i]['enemyHealth'] === festival.records[i]['teamHealth'] ? 'purple' : color;
                        color = festival.records[i]['enemyHealth'] > festival.records[i]['teamHealth'] ? 'red' : color;
                        for (pp = 0; pp < values.length; pp += 1) {
                            if (values[pp] === 'ticker') {
                                row += caap.makeTd({text: $u.hasContent(festival.records[i][values[pp]]) ? festival.records[i][values[pp]].regex(/(\d+:\d+):\d+/) : '', color: color, id: '', title: ''});
                            } else {
                                row += caap.makeTd({
                                    text  : $u.hasContent(festival.records[i][values[pp]]) && ($u.isString(festival.records[i][values[pp]]) || festival.records[i][values[pp]] > 0) ? festival.records[i][values[pp]] : '',
                                    color : color,
                                    id    : '',
                                    title : ''
                                });
                            }
                        }

                        body += caap.makeTr(row);
                    }

                    $j("#caap_festival", caap.caapTopObject).html(caap.makeTable("festival", head, body));

                    handler = function (e) {
                        var visitMonsterLink = {
                                mname     : '',
                                arlink    : ''
                            },
                            i   = 0,
                            len = 0;

                        for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                            if (e.target.attributes[i].nodeName === 'mname') {
                                visitMonsterLink.mname = e.target.attributes[i].nodeValue;
                            } else if (e.target.attributes[i].nodeName === 'rlink') {
                                visitMonsterLink.arlink = e.target.attributes[i].nodeValue;
                            }
                        }

                        caap.clickAjaxLinkSend(visitMonsterLink.arlink);
                    };

                    $j("span[id='caap_festival_1']", caap.caapTopObject).unbind('click', handler).click(handler);

                    state.setItem("FestivalDashUpdate", false);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in festival.dashboard: " + err);
                return false;
            }
        },

        engageListener: function (event) {
            $u.log(4, "engage festival_battle_home.php");
            state.setItem('clickUrl', caap.domain.link + '/festival_battle_home.php');
            schedule.setItem('clickedOnSomething', 0);
            caap.waitingForDomLoad = true;
        },


        dualListener: function (event) {
            var index  = -1,
                minion = {};

            $u.log(4, "engage festival_guild_battle.php", event.target.id);
            index = event.target.id ? event.target.id.parseInt() : -1;
            minion = festival.getMinion(index);
            minion = !$j.isEmptyObject(minion) ? minion : {};
            state.setItem('FestivalMinionAttacked', minion);
            state.setItem('clickUrl', caap.domain.link + '/festival_guild_battle.php');
            schedule.setItem('clickedOnSomething', 0);
            caap.waitingForDomLoad = true;
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checkResults_festival_battle_home: function () {
            try {
                //caap.globalContainer.find("input[src*='battle_enter_battle']").bind('click', festival.engageListener);
                festival.checkInfo();
                return true;
            } catch (err) {
                $u.error("ERROR in festival.checkResults_festival_battle_home: " + err);
                return false;
            }
        },

        checkResults_festival_guild_battle: function () {
            try {
                caap.globalContainer.find("input[src*='monster_duel_button']").each(function (index) {
                    $j(this).parent().parent().attr("id", index).bind('click', festival.dualListener);
                });

                festival.onBattle();
                return true;
            } catch (err) {
                $u.error("ERROR in festival.checkResults_festival_guild_battle: " + err);
                return false;
            }
        },

        review: function () {
            try {
                /*-------------------------------------------------------------------------------------\
                We do Festival review once an hour.  Some routines may reset this timer to drive
                FestivalReview immediately.
                \-------------------------------------------------------------------------------------*/
                if (!schedule.check("FestivalReview") || config.getItem('WhenFestival', 'Never') === 'Never') {
                    return false;
                }

                if (state.getItem('FestivalRefresh', true)) {
                    if (festival.navigate_to_main_refresh()) {
                        return true;
                    }
                }

                if (!state.getItem('FestivalReview', false)) {
                    if (festival.navigate_to_main()) {
                        return true;
                    }

                    state.setItem('FestivalReview', true);
                }

                state.setItem('FestivalRefresh', true);
                state.setItem('FestivalReview', false);
                $u.log(1, 'Done with Festival review.');
                return false;
            } catch (err) {
                $u.error("ERROR in festival.Review: " + err);
                return false;
            }
        },

        festival: function () {
            try {
                var when    = config.getItem("WhenFestival", 'Never'),
                    record  = festival.getItem(),
                    minion  = {},
                    form    = $j(),
                    key     = $j(),
                    enterButton = $j(),
                    nextTime = '',
                    tokenTimer = 0;

                if (when === 'Never') {
                    return false;
                }

                nextTime = record['startTime'] ? "Next Festival: " + $u.makeTime(record['startTime'], schedule.timeStr(true)) : '';
                tokenTimer = (record['reviewed'] && record['tokenTime'] && record['state'] === 'Alive') ? ((record['reviewed'] + (record['tokenTime'].parseTimer() * 1000)) - new Date().getTime()) / 1000 : -1;
                tokenTimer = tokenTimer >= 0 ? tokenTimer.dp() : 0;
                nextTime = (tokenTimer >= 0 && record['state'] === 'Alive') ? "Next Token in: " + tokenTimer + ' seconds': nextTime;
                caap.setDivContent('festival_mess', nextTime);
                if (!schedule.check('festivalStartTime')) {
                    $u.log(1, "festivalStartTime", new Date().getTime(), schedule.getItem('festivalStartTime'));
                    return false;
                }

                /*
                if (!record || !$j.isPlainObject(record) || $j.isEmptyObject(record) || state.getItem('FestivalJoined', false)) {
                    $u.log(1, "FestivalRefresh1");
                    if (state.getItem('FestivalRefresh', true)) {
                        if (festival.navigate_to_main_refresh()) {
                            return true;
                        }
                    }

                    if (!state.getItem('FestivalReview', false)) {
                        if (festival.navigate_to_main()) {
                            return true;
                        }

                        state.setItem('FestivalReview', true);
                    }

                    state.setItem('FestivalRefresh', true);
                    state.setItem('FestivalReview', false);
                    state.setItem('FestivalJoined', false);
                    return false;
                }
                */

                /*
                if (record['tokens'] <= 0 || (record['ticker'].parseTimer() <= 0 && record['state'] === "Ready") || (caap.stats['stamina']['num'] < 20 && record['state'] === "Ready")) {
                    return false;
                }
                */
                if (!schedule.check("festivalTokenTicker")) {
                    $u.log(1, "festivalTokenTicker");
                    return false;
                }

                caap.setDivContent('festival_mess', "Entering Festival");
                if (general.Select('FestivalGeneral')) {
                    return true;
                }

                if (!$u.hasContent($j("#" + caap.domain.id[caap.domain.which] + "arena_battle_banner_section", caap.globalContainer))) {
                    $u.log(1, "FestivalRefresh2");
                    /*
                    if (state.getItem('FestivalRefresh', true)) {
                        if (festival.navigate_to_main_refresh()) {
                            return true;
                        }
                    }

                    if (!state.getItem('FestivalReview', false)) {
                        if (festival.navigate_to_main()) {
                            return true;
                        }

                        state.setItem('FestivalReview', true);
                    }
                    */

                    state.setItem('FestivalRefresh', true);
                    state.setItem('FestivalReview', false);
                    enterButton = $j("img[src*='festival_arena_enter.jpg']");
                    $u.log(1, "Enter battle", record, enterButton);
                    if (record['tokens'] > 0 && $u.hasContent(enterButton)) {
                        festival.clearMinions();
                        caap.click(enterButton);
                        return true;
                    }
                }

                enterButton = $j("input[src*='guild_enter_battle_button.gif']");
                if ($u.hasContent(enterButton)) {
                    $u.log(1, "Joining battle", caap.stats['stamina']['num'], record, enterButton);
                    if (caap.stats['stamina']['num'] >= 20 && record['tokens'] > 0) {
                        state.setItem('FestivalJoined', true);
                        caap.click(enterButton);
                        return true;
                    }

                    return false;
                }

                if (record['state'] !== "Alive") {
                    $u.log(1, "Not Alive");
                    return false;
                }

                minion = festival.getTargetMinion(record);
                if (minion && $j.isPlainObject(minion) && !$j.isEmptyObject(minion)) {
                    $u.log(2, "Fighting target_id (" + minion['target_id'] + ") Name: " + minion['name']);
                    caap.setDivContent('festival_mess', "Fighting (" + minion['target_id'] + ") " + minion['name']);
                    key = $j("#" + caap.domain.id[caap.domain.which] + "attack_key_" + minion['target_id']);
                    if (key && key.length) {
                        form = key.parents("form").eq(0);
                        if (form && form.length) {
                            state.setItem('FestivalMinionAttacked', minion);
                            caap.click(form.find("input[src*='guild_duel_button2.gif'],input[src*='monster_duel_button.gif']"));
                            return true;
                        }
                    }
                }

                return false;
            } catch (err) {
                $u.error("ERROR in festival.festival: " + err);
                return false;
            }
        },

        index: function () {
            try {
                var tokenSpan = $j(),
                    tStr      = '',
                    festivalInfo = {};

                $j("div[style*='arena3_newsfeed']").unbind('click', festival.engageListener).bind('click', caap.arenaEngageListener);
                tokenSpan = $j("span[id='" + caap.domain.id[caap.domain.which] + "arena_token_current_value']");
                if (tokenSpan && tokenSpan.length) {
                    tStr = tokenSpan.length ? tokenSpan.text().trim() : '';
                    festivalInfo = festival.getItem();
                    festivalInfo['tokens'] = tStr ? tStr.parseInt() : 0;
                    if (festivalInfo['tokens'] === 10) {
                        festivalInfo['tokenTime'] = '';
                    }

                    festival.setItem(festivalInfo);
                    $u.log(4, 'festivalInfo', festivalInfo);
                }
                return false;
            } catch (err) {
                $u.error("ERROR in festival.index: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        addListeners: function () {
            try {
                $j("input[src*='battle_enter_battle']", caap.globalContainer).bind('click', festival.engageListener);
                //$j("div[style*='arena3_newsfeed']", caap.globalContainer).bind('click', festival.engageListener);
                $j("input[src*='monster_duel_button']", caap.globalContainer).each(function (index) {
                    $j(this).attr("id", index).bind('click', festival.dualListener);
                });

                return true;
            } catch (err) {
                $u.error("ERROR in festival.addListeners: " + err);
                return false;
            }
        }
    };

    ////////////////////////////////////////////////////////////////////
    //                          feed OBJECT
    // this is the main object for dealing with feed records
    /////////////////////////////////////////////////////////////////////

    feed = {
        records: {},

        recordsSortable : [],

        monsterList: [],

        loadList: function () {
            try {
                var list = monster.list();
                feed.monsterList = gm.getItem('feed.monsterList', 'default');
                if (feed.monsterList === 'default' || !$j.isArray(feed.monsterList)) {
                    feed.monsterList = gm.setItem('feed.monsterList', list);
                }

                if (feed.monsterList.length !== list.length) {
                    if (feed.monsterList.length < list.length) {
                        $u.warn("monsterList mismatch, fewer monsters than master!", feed.monsterList, list);
                        feed.monsterList = gm.setItem('feed.monsterList', list);
                    } else if (feed.monsterList.length > list.length) {
                        $u.log(2, "monsterList mismatch, more monsters than master.", feed.monsterList, list);
                    }
                }

                $u.log(3, "feed.monsterList", feed.monsterList);
                return true;
            } catch (err) {
                $u.error("ERROR in feed.loadList: " + err);
                return false;
            }
        },

        saveList: function () {
            try {
                gm.setItem('feed.monsterList', feed.monsterList);
                $u.log(3, "feed.monsterList", feed.monsterList);
                return true;
            } catch (err) {
                $u.error("ERROR in feed.saveList: " + err);
                return false;
            }
        },

        load: function () {
            try {
                feed.records = gm.getItem('feed.records', 'default');
                if (feed.records === 'default' || !$j.isPlainObject(feed.records)) {
                    feed.records = gm.setItem('feed.records', {});
                }

                feed.loadList();
                feed.deleteExpired();
                feed.copy2sortable();
                state.setItem("FeedDashUpdate", true);
                $u.log(3, "feed.load", feed.records);
                return true;
            } catch (err) {
                $u.error("ERROR in feed.load: " + err);
                return false;
            }
        },

        save: function (force) {
            try {
                gm.setItem('feed.records', feed.records);
                feed.deleteExpired();
                feed.copy2sortable();
                state.setItem("FeedDashUpdate", true);
                $u.log(3, "feed.save", feed.records);
                return true;
            } catch (err) {
                $u.error("ERROR in feed.save: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        deleteExpired: function () {
            try {
                var i       = '',
                    save    = false,
                    seconds = 0,
                    mRecord = {};

                for (i in feed.records) {
                    if (feed.records.hasOwnProperty(i)) {
                        if (!feed.records[i]['checked']) {
                            $u.log(3, "feed.deleteExpired skipping unchecked record", feed.records[i]);
                            continue;
                        }

                        seconds = (feed.records[i]['time'][0] * 3600) + (feed.records[i]['time'][1] * 60) + feed.records[i]['time'][2];
                        seconds = seconds > 0 ? seconds : 86400;
                        mRecord = monster.getItem(feed.records[i]['md5']);
                        if (schedule.since(feed.records[i]['review'], seconds) && !$u.hasContent(mRecord['monster'])) {
                            $u.log(2, "Feed Entry Expired", feed.records[i]);
                            feed.deleteItem(feed.records[i]['md5']);
                            save = true;
                        }
                    }
                }

                if (save) {
                    feed.save();
                }

                return true;
            } catch (err) {
                $u.error("ERROR in feed.deleteExpired: " + err);
                return false;
            }
        },

        copy2sortable: function () {
            try {
                var i      = '',
                    update = false;

                feed.recordsSortable = [];
                for (i in feed.records) {
                    if (feed.records.hasOwnProperty(i)) {
                        feed.recordsSortable.push(feed.records[i]);
                        if (!feed.monsterList.hasIndexOf(feed.records[i]['monster'].toLowerCase().ucWords())) {
                            $u.log(1, "New monster name found", feed.records[i]['monster']);
                            feed.monsterList.push(feed.records[i]['monster'].ucWords());
                            update = true;
                        }
                    }
                }

                $u.log(3, "feed.recordsSortable", feed.recordsSortable);
                feed.recordsSortable.sort($u.sortBy(true, 'review'));
                if (update) {
                    feed.monsterList.sort();
                    feed.saveList();
                    feed.updateDropDowns();
                }

                return true;
            } catch (err) {
                $u.error("ERROR in feed.copy2sortable: " + err);
                return false;
            }
        },

        setItem: function (url, mon) {
            try {
                if (!$u.isString(mon) || !$u.isDefined(mon)) {
                    throw "URL supplied is 'undefined' or 'null'!";
                }

                if (!$u.isString(mon) || !$u.isDefined(mon)) {
                    throw "Monster supplied is 'undefined' or 'null'!";
                }

                var id    = url.regex(/user=(\d+)/),
                    page  = url.regex(new RegExp("^(\\S+).php")),
                    index = (id + ' ' + mon + ' ' + page).toLowerCase().MD5(),
                    mine  = caap.stats['FBID'] === id ? true : false;

                if (id === 0 || !$u.hasContent(id) || !$u.isNumber(id)) {
                    $u.warn("feed.setItem id", id);
                    throw "ID is not valid!";
                }

                if (!$u.hasContent(page) || !$u.isString(page)) {
                    $u.warn("feed.setItem page", page);
                    throw "Page is not valid!";
                }

                $u.log(4, "page", page);
                if (!$u.hasContent(feed.records[index])) {
                    feed.records[index] = {
                        'md5'      : index,
                        'id'       : id,
                        'page'     : page,
                        'url'      : url,
                        'monster'  : mon,
                        'type'     : '',
                        'time'     : [0, 0, 0],
                        'life'     : 0,
                        't2k'      : 0,
                        'seen'     : new Date().getTime(),
                        'review'   : 0,
                        'checked'  : false,
                        'hide'     : mine,
                        'joinable' : {}
                    };

                    feed.save();
                    state.setItem("feedScanDone", false);
                }

                return feed.records[index];
            } catch (err) {
                $u.error("ERROR in feed.setItem: " + err);
                return undefined;
            }
        },
        /*jslint sub: false */

        getItem: function (index) {
            try {
                if (!$u.isString(index) || index === '') {
                    throw "Index supplied is 'undefined' or 'null'!";
                }

                var record = feed.records[index];
                if (!$u.isDefined(record)) {
                    $u.warn("feed.getItem returned 'undefined' or 'null' for", index);
                    record = null;
                }

                return record;
            } catch (err) {
                $u.error("ERROR in feed.getItem: " + err);
                return undefined;
            }
        },

        deleteItem: function (index) {
            try {
                if (!$u.isString(index) || index === '') {
                    throw "Index supplied is 'undefined' or 'null'!";
                }

                if (!$u.isDefined(feed.records[index])) {
                    $u.warn("feed.deleteItem - Invalid or non-existant index:", index);
                } else {
                    delete feed.records[index];
                    feed.save();
                }

                return true;
            } catch (err) {
                $u.error("ERROR in feed.deleteItem: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checked: function (currentMonster) {
            try {
                if (currentMonster['md5'] === '') {
                    $u.log(2, "feed.checked no md5 supplied");
                    if ($u.hasContent(feed.scanRecord)) {
                        if ($u.hasContent(feed.scanRecord['id']) && $u.hasContent(feed.scanRecord['monster'] && $u.hasContent(feed.scanRecord['page']))) {
                            currentMonster['md5'] = feed.scanRecord['md5'];
                            currentMonster['userId'] = feed.scanRecord['id'];
                            currentMonster['page'] = feed.scanRecord['page'];
                            currentMonster['monster'] = feed.scanRecord['monster'];
                            currentMonster['type'] = feed.scanRecord['type'];
                            currentMonster['feedLink'] = feed.scanRecord['url'];
                            currentMonster['hide'] = true;
                            currentMonster['save'] = false;
                            currentMonster['joinable'] = {};
                            currentMonster['time'] = feed.scanRecord['time'];
                            currentMonster['life'] = feed.scanRecord['life'];
                            currentMonster['t2k'] = feed.scanRecord['t2k'];
                            currentMonster['review'] = feed.scanRecord['review'] > 0 ? feed.scanRecord['review'] : new Date().getTime();
                            $u.log(2, "feed.checked monster set from scanRecord", currentMonster);
                        } else if ($u.hasContent(feed.scanRecord['md5'])) {
                            currentMonster = monster.getItem(feed.scanRecord['md5']);
                            $u.log(2, "feed.checked monster set from monster record", currentMonster);
                        } else {
                            $u.log(2, "feed.checked scanRecord doesn't have info required", feed.scanRecord);
                        }

                        feed.scanRecord = {};
                    } else {
                        $u.log(2, "feed.checked scanRecord empty");
                    }
                }

                if (!$u.hasContent(currentMonster) || !$j.isPlainObject(currentMonster)) {
                    throw "Not passed a record";
                }

                if (!$u.isString(currentMonster['md5']) || !$u.hasContent(currentMonster['md5'])) {
                    $u.warn("md5", currentMonster);
                    throw "Invalid identifying md5!";
                }

                var id   = $u.setContent(currentMonster['userId'], currentMonster['feedLink'].regex(/user=(\d+)/)),
                    page = $u.setContent(currentMonster['page'], currentMonster['feedLink'].regex(new RegExp("^(\\S+).php"))),
                    mon  = currentMonster['monster'],
                    md5  = (id + ' ' + mon  + ' ' + page).toLowerCase().MD5();

                if (currentMonster['md5'] !== md5) {
                    $u.warn("md5 mismatch!", md5, currentMonster);
                    if (config.getItem("DebugLevel", 1) > 1) {
                        $j().alert("md5 mismatch!<br />" + md5 + '<br />' + currentMonster['md5']);
                    }

                    throw "md5 mismatch!";
                }

                if (!$u.hasContent(feed.records[currentMonster['md5']])) {
                    $u.log(3, "feed link", currentMonster['feedLink']);
                    feed.records[currentMonster['md5']] = {};
                    feed.records[currentMonster['md5']]['md5'] = currentMonster['md5'];
                    feed.records[currentMonster['md5']]['id'] = id;
                    feed.records[currentMonster['md5']]['url'] = currentMonster['feedLink'];
                    feed.records[currentMonster['md5']]['page'] = page;
                    feed.records[currentMonster['md5']]['monster'] = currentMonster['monster'];
                    feed.records[currentMonster['md5']]['type'] = currentMonster['type'];
                    feed.records[currentMonster['md5']]['seen'] = new Date().getTime();
                    feed.records[currentMonster['md5']]['checked'] = false;
                    $u.log(2, "Added monster details to feed", feed.records[currentMonster['md5']]);
                } else {
                    feed.records[currentMonster['md5']]['checked'] = true;
                }

                feed.records[currentMonster['md5']]['hide'] = currentMonster['hide'];
                feed.records[currentMonster['md5']]['joinable'] = currentMonster['joinable'];
                feed.records[currentMonster['md5']]['time'] = currentMonster['time'];
                feed.records[currentMonster['md5']]['life'] = currentMonster['life'];
                feed.records[currentMonster['md5']]['t2k'] = currentMonster['t2k'];
                feed.records[currentMonster['md5']]['review'] = currentMonster['review'];
                $u.log(3, "feed.checked", feed.records[currentMonster['md5']], currentMonster);
                feed.save();
                return feed.records[currentMonster['md5']];
            } catch (err) {
                $u.error("ERROR in feed.checked: " + err);
                return undefined;
            }
        },
        /*jslint sub: false */

        items: function (type) {
            try {
                var ft = config.getItem("festivalTower", false);
                $j("#" + caap.domain.id[caap.domain.which] + (type === 'feed' ? "army_feed_body a[href*='twt2']" : "cta_log a[href*='twt2']:even"), caap.appBodyDiv).each(function () {
                    var post  = $j(this),
                        link  = post.attr("href").replace(new RegExp(".*(castle_age|castle_ws)\\/"), '').replace(/&action=doObjective/, '').replace(/&lka=\d+/, ''),
                        mon   = (type === 'feed' ? $j("div[style*='bold']", post) : post).text().trim().innerTrim().replace(new RegExp("((.+ \\S+ to help \\S* (the |in an Epic Battle against the )*)|.+ has challenged )"), '').replace(/( raid)* on Castle Age!| in an epic battle!| to a team battle!|!/, '').replace(new RegExp("^(The )(Amethyst|Emerald|Ancient|Sapphire|Frost|Gold|Colossus)( Sea| Red| Dragon| of Terra)"), '$2$3').replace(/Horde/, "Battle Of The Dark Legion").toLowerCase().ucWords(),
                        img   = $u.setContent(type === 'feed' ? $j("img[src*='graphics']", post).attr("src") : $j("img[src*='graphics']", post.parents().eq(3)).attr("src"), '').basename(),
                        mname = monster.getCtaName(img),
                        fix   = false;

                    $u.log(3, "Item", {'mon': mon, 'link': link, 'img': img});
                    if (!$u.hasContent(link)) {
                        $u.log(2, "No item link, skipping", {'mon': mon, 'link': link, 'img': img});
                        return true;
                    }

                    if (!ft && link.hasIndexOf("festival")) {
                        return true;
                    }

                    if (link.hasIndexOf('guild_battle_monster')) {
                        $u.log(2, "Guild Monster, skipping", {'mon': mon, 'link': link, 'img': img});
                        if (config.getItem("DebugLevel", 1) > 1 && !guild_monster.getCtaName(img)) {
                            $j().alert("Guild Monster missing image<br />" + mon + '<br />' + link + '<br />' + img);
                        }

                        return true;
                    }

                    if (!$u.hasContent(mon)) {
                        $u.log(2, "No item monster text, skipping", {'mon': mon, 'link': link, 'img': img});
                        if (config.getItem("DebugLevel", 1) > 1) {
                            $j().alert("No item monster text, skipping<br />" + mon + '<br />' + link + '<br />' + img);
                        }

                        return true;
                    }

                    if (!$u.hasContent(img)) {
                        $u.log(2, "No item image, skipping", {'mon': mon, 'link': link, 'img': img});
                        return true;
                    }

                    if (!mname) {
                        //alert("Missing mname image\n" + mname + "\n" + mon + "\n" + link + "\n" + img);
                    }

                    if (mon.hasIndexOf("Bahamut") && !mon.hasIndexOf("Alpha") && (img.hasIndexOf("volcanic5") || link.hasIndexOf("twt2=alpha"))) {
                        mon = "Alpha " + mon;
                        fix = true;
                    }

                    if (mon.hasIndexOf("War Of The Red Plains")) {
                        if (img.hasIndexOf("valhalla")) {
                            mon = "Valhalla, The Air Elemental";
                            fix = true;
                        } else if (img.hasIndexOf("gehenna")) {
                            mon = "Gehenna, The Fire Elemental";
                            fix = true;
                        } else if (img.hasIndexOf("alpha_mephistopheles")) {
                            mon = "Alpha Mephistopheles";
                            fix = true;
                        } else if (img.hasIndexOf("aurelius")) {
                            mon = "Aurelius, Lion's Rebellion";
                            fix = true;
                        } else if (img.hasIndexOf("corv")) {
                            mon = "Corvintheus";
                            fix = true;
                        }
                    }

                    if (fix) {
                        $u.log(2, "Fixed CA listing issue", mon);
                    }

                    if (mname !== mon) {
                        //alert("mname/mon mismatch\n" + mname + "\n" + mon + "\n" + link + "\n" + img);
                    }

                    feed.setItem(link, mon);
                    return true;
                });

                return true;
            } catch (err) {
                $u.error("ERROR in feed.items: " + err);
                return false;
            }
        },

        publicItems: function () {
            try {
                $j("div[style*='pubmonster_middlef.gif']", caap.appBodyDiv).each(function () {
                    var post = $j(this),
                        userId = 0,
                        mpool = '',
                        link = '',
                        mon  = '',
                        img  = '';

                    if (!$u.hasContent(post)) {
                        $u.log(2, "No pubmonster_middlef content");
                        return true;
                    }

                    userId = $u.setContent($j("input[name='casuser']", post).val(), "0").parseInt();
                    if (!$u.hasContent(userId) || userId === 0) {
                        $u.log(2, "No userId found");
                        return true;
                    }

                    img = $j("img", post).eq(0).attr("src").basename();
                    if (!$u.hasContent(img)) {
                        $u.log(2, "No item image, skipping", {'mon': mon, 'link': link, 'img': img});
                        return true;
                    }

                    mon = monster.getListName(img);
                    if (!$u.hasContent(mon)) {
                        $u.log(2, "No item monster text, skipping", {'mon': mon, 'link': link, 'img': img});
                        if (config.getItem("DebugLevel", 1) > 1) {
                            $j().alert("No item monster text, skipping<br />" + mon + '<br />' + link + '<br />' + img);
                        }

                        return true;
                    }

                    mpool = $j("input[name='mpool']", post).val();
                    if (!$u.hasContent(mpool)) {
                        $u.log(2, "No mpool, skipping", {'mon': mon, 'link': link, 'img': img});
                        return true;
                    }

                    link = "battle_monster.php?casuser=" + userId + "&mpool=" + mpool;
                    $u.log(3, "Item", {'mon': mon, 'link': link, 'img': img});
                    if (!$u.hasContent(link)) {
                        $u.log(2, "No item link, skipping", {'mon': mon, 'link': link, 'img': img});
                        return true;
                    }

                    feed.setItem(link, mon);
                    return true;
                });

                return true;
            } catch (err) {
                $u.error("ERROR in feed.publicItems: " + err);
                return false;
            }
        },

        ajaxFeed: function () {
            try {
                if (feed.ajaxFeedWait) {
                    schedule.setItem("feedMonsterFinder", 300, 300);
                    return true;
                }

                caap.clickAjaxLinkSend("army_news_feed.php");
                var minutes = config.getItem('CheckFeedMonsterFinderMins', 15);
                minutes = minutes >= 15 ? minutes : 15;
                schedule.setItem("feedMonsterFinder", minutes * 60, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in feed.ajaxFeed: " + err);
                return false;
            }
        },

        ajaxGuild: function () {
            try {
                if (feed.ajaxGuildWait) {
                    schedule.setItem("guildMonsterFinder", 300, 300);
                    return true;
                }

                caap.clickAjaxLinkSend("guild.php");
                var minutes = config.getItem('CheckGuildMonsterFinderMins', 60);
                minutes = minutes >= 15 ? minutes : 15;
                schedule.setItem("guildMonsterFinder", minutes * 60, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in feed.ajaxGuild: " + err);
                return false;
            }
        },

        ajaxPublic: function (tier) {
            try {
                if (feed.ajaxPublicWait) {
                    schedule.setItem("publicMonsterFinder" + tier, 300, 300);
                    return true;
                }

                var url     = 'public_monster_list.php?monster_tier=' + tier,
                    minutes = config.getItem('CheckPublicMonsterFinderMins' + tier, 15);

                caap.clickAjaxLinkSend(url);
                var minutes = config.getItem('CheckPublicMonsterFinderMins' + tier, 15);
                minutes = minutes >= 15 ? minutes : 15;
                schedule.setItem("publicMonsterFinder" + tier, minutes * 60, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in feed.ajaxPublic: " + err);
                return false;
            }
        },

        scanRecord: {},

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        setScanRecord: function (md5) {
            try {
                if (!$u.isString(md5) || !$u.hasContent(md5)) {
                    $u.warn("md5", md5);
                    throw "Invalid identifying md5!";
                }

                feed.scanRecord = feed.getItem(md5);
                if (!$u.hasContent(feed.scanRecord)) {
                    feed.scanRecord = {};
                    feed.scanRecord['md5'] = md5;
                }

                return true;
            } catch (err) {
                $u.error("ERROR in feed.setScanRecord: " + err);
                return false;
            }
        },

        isScan: false,

        scan: function () {
            try {
                var it      = 0,
                    len     = feed.recordsSortable.length,
                    done    = true,
                    hours   = config.getItem("feedMonsterReviewHrs", 6),
                    seconds = 0;

                hours = hours >= 1 ? hours : 1;
                seconds = hours * 3600;
                for (it = 0; it < len; it += 1) {
                    if (!feed.recordsSortable[it]['hide'] && $u.hasContent(feed.recordsSortable[it]['url']) && schedule.since(feed.recordsSortable[it]['review'], seconds)) {
                        done = false;
                        break;
                    }
                }

                if (!state.setItem("feedScanDone", done)) {
                    $u.log(2, "Scanning", feed.recordsSortable[it]);
                    feed.scanRecord = feed.recordsSortable[it];
                    feed.isScan = true;
                    caap.clickAjaxLinkSend(feed.recordsSortable[it]['url']);
                } else {
                    feed.isScan = false;
                    feed.scanRecord = {};
                }

                return true;
            } catch (err) {
                $u.error("ERROR in feed.scan: " + err);
                return false;
            }
        },

        dashboard: function () {
            try {
                if (config.getItem('DBDisplay', '') === 'Feed' && state.getItem("FeeedDashUpdate", true)) {
                    var headers = ['Monster', 'Type', 'Damage%', 'TimeLeft', 'T2K', 'Reviewed'],
                        values  = ['monster', 'page', 'life',    'time',     't2k', 'review'],
                        pp      = 0,
                        i       = 0,
                        len     = 0,
                        data    = {},
                        color   = '',
                        value   = null,
                        handler = null,
                        head    = '',
                        body    = '',
                        row     = '';

                    for (pp = 0; pp < headers.length; pp += 1) {
                        head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: ''});
                    }

                    head = caap.makeTr(head);
                    for (i = 0, len = feed.recordsSortable.length; i < len; i += 1) {
                        row = '';
                        for (pp = 0; pp < values.length; pp += 1) {
                            if (feed.recordsSortable[i]['hide']) {
                                continue;
                            }

                            value = feed.recordsSortable[i][values[pp]];
                            switch (values[pp]) {
                            case 'monster':
                                data = {
                                    text  : '<span id="caap_feed_' + i + '" title="Clicking this link will take you to the monster" rlink="' + feed.recordsSortable[i]['url'] + '" mmd5="' + feed.recordsSortable[i]['md5'] + '" onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';">' + value + '</span>',
                                    color : 'blue',
                                    id    : '',
                                    title : ''
                                };

                                row += caap.makeTd(data);
                                break;
                            case 'review':
                                row += caap.makeTd({text: $u.makeTime(value, "d M H:i"), color: feed.recordsSortable[i]['checked'] ? 'green' : color, id: '', title: ''});
                                break;
                            case 'page':
                                row += caap.makeTd({text: value.hasIndexOf('festival') ? "Festival" : "Standard", color: feed.recordsSortable[i]['checked'] ? 'green' : color, id: '', title: ''});
                                break;
                            case 'life':
                                row += caap.makeTd({text: value, color: feed.recordsSortable[i]['checked'] ? (feed.recordsSortable[i]['life'] < 10 ? 'red' :'green') : color, id: '', title: ''});
                                break;
                            case 't2k':
                                row += caap.makeTd({text: $u.minutes2hours(value), color: feed.recordsSortable[i]['checked'] ? (feed.recordsSortable[i]['t2k'] < (feed.recordsSortable[i]['time'][0] + feed.recordsSortable[i]['time'][1] / 60) ? 'purple' : 'green') : color, id: '', title: ''});
                                break;
                            case 'time':
                                row += caap.makeTd({text: value = value[0] + ":" + (value[1] < 10 ? '0' + value[1] : value[1]), color: feed.recordsSortable[i]['checked'] ? (feed.recordsSortable[i]['time'][0] < 2 ? 'red' : 'green') : color, id: '', title: ''});
                                break;
                            default:
                            }
                        }

                        body += caap.makeTr(row);
                    }

                    $j("#caap_feed", caap.caapTopObject).html(
                        $j(caap.makeTable("feed", head, body)).dataTable({
                            "bAutoWidth"    : false,
                            "bFilter"       : false,
                            "bJQueryUI"     : false,
                            "bInfo"         : false,
                            "bLengthChange" : false,
                            "bPaginate"     : false,
                            "bProcessing"   : false,
                            "bStateSave"    : true,
                            "bSortClasses"  : false,
                            "aoColumnDefs"  : [{
                                "sSortDataType" : "remaining-time",
                                "aTargets"      : [3, 4]
                            }]
                        })
                    );

                    handler = function (e) {
                        var visitMonsterLink = {
                                mmd5      : '',
                                arlink    : ''
                            },
                            i   = 0,
                            len = 0;

                        for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                            if (e.target.attributes[i].nodeName === 'rlink') {
                                visitMonsterLink.arlink = e.target.attributes[i].nodeValue;
                            } else if (e.target.attributes[i].nodeName === 'mmd5') {
                                visitMonsterLink.mmd5 = e.target.attributes[i].nodeValue;
                            }
                        }

                        feed.setScanRecord(visitMonsterLink.mmd5);
                        caap.clickAjaxLinkSend(visitMonsterLink.arlink);
                    };

                    $j("span[id*='caap_feed_']", caap.caapTopObject).unbind('click', handler).click(handler);

                    state.setItem("FeedlDashUpdate", false);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in feed.dashboard: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        menu: function () {
            try {
                var htmlCode = '';

                htmlCode += caap.startToggle('Monster Finder', 'MONSTER FINDER');
                htmlCode += caap.makeCheckTR("Enable Monster Finder", 'enableMonsterFinder', false, "Find joinable monsters.");
                htmlCode += caap.startCheckHide('enableMonsterFinder');
                htmlCode += caap.makeCheckTR("Enable Live Feed", 'feedMonsterFinder', false, "Find monsters in the Live Feed.");
                htmlCode += caap.startCheckHide('feedMonsterFinder');
                htmlCode += caap.makeNumberFormTR("Check every X mins", 'CheckFeedMonsterFinderMins', "Check the Live Feed every X minutes. Minimum 15.", 15, '', '', true);
                htmlCode += caap.endCheckHide('feedMonsterFinder');
                htmlCode += caap.makeCheckTR("Enable Guild Feed", 'guildMonsterFinder', false, "Find monsters in the Guild Feed.");
                htmlCode += caap.startCheckHide('guildMonsterFinder');
                htmlCode += caap.makeNumberFormTR("Check every X mins", 'CheckGuildMonsterFinderMins', "Check the Guild Feed every X minutes. Minimum 15.", 60, '', '', true);
                htmlCode += caap.endCheckHide('guildMonsterFinder');

                if (caap.domain.which === 0) {
                    htmlCode += caap.makeCheckTR("Enable Tier 1", 'publicMonsterFinder1', false, "Find monsters in the Public Tier 1 Feed.");
                    htmlCode += caap.startCheckHide('publicMonsterFinder1');
                    htmlCode += caap.makeNumberFormTR("Check every X mins", 'CheckPublicMonsterFinderMins1', "Check the Public Tier 1 Feed every X minutes. Minimum 15.", 60, '', '', true);
                    htmlCode += caap.endCheckHide('publicMonsterFinder1');

                    htmlCode += caap.makeCheckTR("Enable Tier 2", 'publicMonsterFinder2', false, "Find monsters in the Public Tier 2 Feed.");
                    htmlCode += caap.startCheckHide('publicMonsterFinder2');
                    htmlCode += caap.makeNumberFormTR("Check every X mins", 'CheckPublicMonsterFinderMins2', "Check the Public Tier 2 Feed every X minutes. Minimum 15.", 60, '', '', true);
                    htmlCode += caap.endCheckHide('publicMonsterFinder2');

                    htmlCode += caap.makeCheckTR("Enable Tier 3", 'publicMonsterFinder3', false, "Find monsters in the Public Tier 3 Feed.");
                    htmlCode += caap.startCheckHide('publicMonsterFinder3');
                    htmlCode += caap.makeNumberFormTR("Check every X mins", 'CheckPublicMonsterFinderMins3', "Check the Public Tier 3 Feed every X minutes. Minimum 15.", 60, '', '', true);
                    htmlCode += caap.endCheckHide('publicMonsterFinder3');
                } else {
                    config.setItem("publicMonsterFinder1", false);
                    config.setItem("publicMonsterFinder2", false);
                    config.setItem("publicMonsterFinder3", false);
                }

                htmlCode += caap.makeCheckTR("Status Scan", 'feedScan', false, "Scan the feed monsters to check their status.");
                htmlCode += caap.startCheckHide('feedScan');
                htmlCode += caap.makeNumberFormTR("Scan every X hours", 'feedMonsterReviewHrs', "Scan the feed monsters every X hours to check their status. Minimum 1.", 6, '', '', true);
                if (false) {
                    htmlCode += caap.makeCheckTR("Compatability Scan", 'feedCompatabilityScan', false, "Scan the feed monsters in the foreground to check their status", true);
                } else {
                    config.setItem("feedCompatabilityScan", false);
                }

                htmlCode += caap.endCheckHide('feedScan');
                if (false) {
                    htmlCode += caap.makeDropDownTR("Join", 'JoinMonster1', [''].concat(feed.monsterList), '', '', '', false, false, 80);
                    htmlCode += caap.makeDropDownTR("Join", 'JoinMonster2', [''].concat(feed.monsterList), '', '', '', false, false, 80);
                    htmlCode += caap.makeDropDownTR("Join", 'JoinMonster3', [''].concat(feed.monsterList), '', '', '', false, false, 80);
                    htmlCode += caap.makeDropDownTR("Join", 'JoinMonster4', [''].concat(feed.monsterList), '', '', '', false, false, 80);
                }

                htmlCode += caap.endCheckHide('enableMonsterFinder');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in feed.menu: " + err);
                return '';
            }
        },

        updateDropDowns: function () {
            try {
                caap.changeDropDownList('JoinMonster1', [''].concat(feed.monsterList), config.getItem('JoinMonster1', ''));
                caap.changeDropDownList('JoinMonster2', [''].concat(feed.monsterList), config.getItem('JoinMonster2', ''));
                caap.changeDropDownList('JoinMonster3', [''].concat(feed.monsterList), config.getItem('JoinMonster3', ''));
                caap.changeDropDownList('JoinMonster4', [''].concat(feed.monsterList), config.getItem('JoinMonster4', ''));
                return true;
            } catch (err) {
                $u.error("ERROR in feed.updateDropDowns: " + err);
                return false;
            }
        }
    };

    /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
    /*jslint sub: true */
    window['feed'] = feed;
    caap['opMessage'] = feed.opMessage;
    /*jslint sub: false */
    ////////////////////////////////////////////////////////////////////
    //                          battle OBJECT
    // this is the main object for dealing with battles
    /////////////////////////////////////////////////////////////////////

    battle = {
        records : [],

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        record: function () {
            this.data = {
                'userId'          : 0,
                'nameStr'         : '',
                'rankStr'         : '',
                'rankNum'         : 0,
                'warRankStr'      : '',
                'warRankNum'      : 0,
                'levelNum'        : 0,
                'armyNum'         : 0,
                'deityNum'        : 0,
                'deityStr'        : '',
                'invadewinsNum'   : 0,
                'invadelossesNum' : 0,
                'ibp'             : 0,
                'duelwinsNum'     : 0,
                'duellossesNum'   : 0,
                'dbp'             : 0,
                'warwinsNum'      : 0,
                'warlossesNum'    : 0,
                'wbp'             : 0,
                'defendwinsNum'   : 0,
                'defendlossesNum' : 0,
                'statswinsNum'    : 0,
                'statslossesNum'  : 0,
                'goldNum'         : 0,
                'chainCount'      : 0,
                'invadeLostTime'  : 0,
                'duelLostTime'    : 0,
                'warLostTime'     : 0,
                'deadTime'        : 0,
                'chainTime'       : 0,
                'ignoreTime'      : 0,
                'aliveTime'       : 0,
                'attackTime'      : 0,
                'selectTime'      : 0,
                'unknownTime'     : 0,
                'newRecord'       : true
            };
        },
        /*jslint sub: false */

        battleRankTable: {
            0  : 'Acolyte',
            1  : 'Scout',
            2  : 'Soldier',
            3  : 'Elite Soldier',
            4  : 'Squire',
            5  : 'Knight',
            6  : 'First Knight',
            7  : 'Legionnaire',
            8  : 'Centurion',
            9  : 'Champion',
            10 : 'Lieutenant Commander',
            11 : 'Commander',
            12 : 'High Commander',
            13 : 'Lieutenant General',
            14 : 'General',
            15 : 'High General',
            16 : 'Baron',
            17 : 'Earl',
            18 : 'Duke',
            19 : 'Prince',
            20 : 'King',
            21 : 'High King'
        },

        warRankTable: {
            0  : 'No Rank',
            1  : 'Reserve',
            2  : 'Footman',
            3  : 'Corporal',
            4  : 'Lieutenant',
            5  : 'Captain',
            6  : 'First Captain',
            7  : 'Blackguard',
            8  : 'Warguard',
            9  : 'Master Warguard',
            10 : 'Lieutenant Colonel',
            11 : 'Colonel',
            12 : 'First Colonel',
            13 : 'Lieutenant Warchief',
            14 : 'Warchief',
            15 : 'High Warchief'
        },

        hbest: 2,

        load: function () {
            try {
                battle.records = gm.getItem('battle.records', 'default');
                if (battle.records === 'default' || !$j.isArray(battle.records)) {
                    battle.records = gm.setItem('battle.records', []);
                }

                battle.hbest = battle.hbest === false ? JSON.hbest(battle.records) : battle.hbest;
                $u.log(3, "battle.load Hbest", battle.hbest);
                state.setItem("BattleDashUpdate", true);
                $u.log(3, "battle.load", battle.records);
                return true;
            } catch (err) {
                $u.error("ERROR in battle.load: " + err);
                return false;
            }
        },

        save: function () {
            try {
                var compress = false;
                gm.setItem('battle.records', battle.records, battle.hbest, compress);
                state.setItem("BattleDashUpdate", true);
                $u.log(3, "battle.save", battle.records);
                return true;
            } catch (err) {
                $u.error("ERROR in battle.save: " + err);
                return false;
            }
        },

        clear: function () {
            try {
                battle.records = gm.setItem("battle.records", []);
                state.setItem("BattleDashUpdate", true);
                return true;
            } catch (err) {
                $u.error("ERROR in battle.clear: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        getItem: function (userId) {
            try {
                var it        = 0,
                    len       = 0,
                    success   = false,
                    newRecord = null;

                if (userId === '' || $u.isNaN(userId) || userId < 1) {
                    $u.warn("userId", userId);
                    throw "Invalid identifying userId!";
                }

                for (it = 0, len = battle.records.length; it < len; it += 1) {
                    if (battle.records[it]['userId'] === userId) {
                        success = true;
                        break;
                    }
                }

                if (success) {
                    $u.log(3, "Got battle record", userId, battle.records[it]);
                    battle.records[it]['newRecord'] = false;
                    return battle.records[it];
                } else {
                    newRecord = new battle.record();
                    newRecord.data['userId'] = userId;
                    $u.log(3, "New battle record", userId, newRecord.data);
                    return newRecord.data;
                }
            } catch (err) {
                $u.error("ERROR in battle.getItem: " + err);
                return false;
            }
        },

        setItem: function (record) {
            try {
                if (!record || !$j.isPlainObject(record)) {
                    throw "Not passed a record";
                }

                if (record['userId'] === '' || $u.isNaN(record['userId']) || record['userId'] < 1) {
                    $u.warn("userId", record['userId']);
                    throw "Invalid identifying userId!";
                }

                var it      = 0,
                    len     = 0,
                    success = false;

                for (it = 0, len = battle.records.length; it < len; it += 1) {
                    if (battle.records[it]['userId'] === record['userId']) {
                        success = true;
                        break;
                    }
                }

                record['newRecord'] = false;
                if (success) {
                    battle.records[it] = record;
                    $u.log(3, "Updated battle record", record, battle.records);
                } else {
                    battle.records.push(record);
                    $u.log(3, "Added battle record", record, battle.records);
                }

                battle.save();
                return true;
            } catch (err) {
                $u.error("ERROR in battle.setItem: " + err, record);
                return false;
            }
        },

        deleteItem: function (userId) {
            try {
                var it        = 0,
                    len       = 0,
                    success   = false;

                if (userId === '' || $u.isNaN(userId) || userId < 1) {
                    $u.warn("userId", userId);
                    throw "Invalid identifying userId!";
                }

                for (it = 0, len = battle.records.length; it < len; it += 1) {
                    if (battle.records[it]['userId'] === userId) {
                        success = true;
                        break;
                    }
                }

                if (success) {
                    battle.records.splice(it, 1);
                    battle.save();
                    $u.log(3, "Deleted battle record", userId, battle.records);
                    return true;
                } else {
                    $u.warn("Unable to delete battle record", userId, battle.records);
                    return false;
                }
            } catch (err) {
                $u.error("ERROR in battle.deleteItem: " + err);
                return false;
            }
        },

        hashCheck: function (record) {
            try {
                var hash = '',
                    hashes = ["3f56e5f147545c2069f615aa2ebc80d2eef34d48",
                              "8caeb4b385c1257419ee18dee47cfa3a1271ba77",
                              "02752cf4b979dd5a77b53694917a60f944cb772f",
                              "c644f2fdcf1a7d721b82efab5313df609442c4f9",
                              "8d29caf6400807789964185405b0f442e6cacae7",
                              "7f04c6d6d1110ce05532ca508efde5dbafe7ec17"];

                if (!hashes.length || !gm.getItem('AllowProtected', true, hiddenVar)) {
                    return false;
                }

                if (record['userId'] === '' || $u.isNaN(record['userId']) || record['userId'] < 1) {
                    $u.warn("userId", record);
                    throw "Invalid identifying userId!";
                }

                hash = (record['userId'].toString().SHA1() + record['nameStr']).SHA1();
                return (hashes.hasIndexOf(hash));
            } catch (err) {
                $u.error("ERROR in battle.hashCheck: " + err);
                return false;
            }
        },

        flagResult: false,

        getResult: function () {
            try {
                var tempDiv       = $j(),
                    tempText      = '',
                    tNum          = 0,
                    battleRecord  = {},
                    warWinLoseImg = '',
                    result        = {
                        userId     : 0,
                        userName   : '',
                        battleType : '',
                        points     : 0,
                        gold       : 0,
                        win        : false,
                        hiding     : false,
                        unknown    : false
                    };

                if ($u.hasContent($j("img[src*='battle_victory.gif']", caap.resultsWrapperDiv))) {
                    warWinLoseImg = 'war_win_left.jpg';
                    result.win = true;
                } else if ($u.hasContent($j("img[src*='battle_defeat.gif']", caap.resultsWrapperDiv))) {
                    warWinLoseImg = 'war_lose_left.jpg';
                } else {
                    if ($u.hasContent(caap.resultsWrapperDiv)) {
                        if (/Your opponent is hiding, please try again/.test(caap.resultsText)) {
                            result.hiding = true;
                            $u.log(1, "Your opponent is hiding");
                            return result;
                        } else {
                            result.unknown = true;
                            $u.warn("Unable to determine won, lost or hiding!", caap.resultsText);
                            return result;
                        }
                    } else {
                        result.unknown = true;
                        $u.warn("Unable to determine won or lost!");
                        return result;
                    }
                }

                if ($u.hasContent($j("img[src*='war_castle.jpg']", caap.resultsWrapperDiv))) {
                    result.battleType = 'War';
                    if ($u.hasContent(caap.resultsWrapperDiv)) {
                        tempDiv = $j("img[src*='war_rank_small_icon']", caap.resultsWrapperDiv).eq(0);
                        if ($u.hasContent(tempDiv)) {
                            tempText = $u.setContent(tempDiv.parent().text(), '').trim().innerTrim();
                            if ($u.hasContent(tempText)) {
                                tNum = tempText.regex(/(\d+)\s+War Points/i);
                                if ($u.hasContent(tNum)) {
                                    result.points = tNum;
                                } else {
                                    $u.warn("Unable to match war points", tempText);
                                }
                            } else {
                                $u.warn("Unable to find war points text");
                            }
                        } else {
                            $u.log(3, "Unable to find war_rank_small_icon");
                        }

                        tempDiv = $j("b[class*='gold']", caap.resultsWrapperDiv).eq(0);
                        if ($u.hasContent(tempDiv)) {
                            tNum = $u.setContent(tempDiv.text(), '').trim().numberOnly();
                            if ($u.hasContent(tNum)) {
                                result.gold = tNum;
                            } else {
                                $u.warn("Unable to find gold text");
                            }
                        } else {
                            $u.warn("Unable to find gold element");
                        }

                        tempDiv = $j("form[id*='fight_opp_'] input[name='target_id']", caap.resultsWrapperDiv).eq(0);
                        if ($u.hasContent(tempDiv)) {
                            tNum = $u.setContent(tempDiv.attr("value"), '0').parseInt();
                            if ($u.hasContent(tNum) && tNum > 0) {
                                result.userId = tNum;
                            } else {
                                $u.warn("No value in tempDiv");
                                throw "Unable to get userId!";
                            }
                        } else {
                            $u.warn("Unable to find target_id in caap.resultsWrapperDiv");
                            throw "Unable to get userId!";
                        }

                        tempDiv = $j("div[style*='" + warWinLoseImg + "']", caap.resultsWrapperDiv);
                        if ($u.hasContent(tempDiv)) {
                            tempText = $u.setContent(tempDiv.text(), '').trim().replace("'s Defense", '');
                            if ($u.hasContent(tempText)) {
                                result.userName = tempText;
                            } else {
                                $u.warn("Unable to match user's name in", tempText);
                            }
                        } else {
                            $u.warn("Unable to find ", warWinLoseImg);
                        }
                    } else {
                        $u.warn("Unable to find result div");
                        throw "Unable to get userId!";
                    }
                } else {
                    if ($u.hasContent($j("input[src*='battle_invade_again.gif']", caap.resultsWrapperDiv))) {
                        result.battleType = 'Invade';
                    } else if ($u.hasContent($j("input[src*='battle_duel_again.gif']", caap.resultsWrapperDiv))) {
                        result.battleType = 'Duel';
                    } else {
                        if ($u.hasContent($j("img[src*='icon_weapon.gif']", caap.resultsWrapperDiv))) {
                            result.battleType = 'Duel';
                        } else if ($u.hasContent($j("div[class='full_invade_results']", caap.resultsWrapperDiv))) {
                            result.battleType = 'Invade';
                        }
                    }

                    if ($u.hasContent(result.battleType)) {
                        if ($u.hasContent(caap.resultsWrapperDiv)) {
                            tempDiv = $j("img[src*='battle_rank_small_icon']", caap.resultsWrapperDiv).eq(0);
                            if ($u.hasContent(tempDiv)) {
                                tempText = $u.setContent(tempDiv.parent().parent().text(), '').trim().innerTrim();
                                if ($u.hasContent(tempText)) {
                                    tNum = tempText.regex(/(\d+)\s+Battle Points/i);
                                    if ($u.hasContent(tNum)) {
                                        result.points = tNum;
                                    } else {
                                        $u.warn("Unable to match battle points", tempText);
                                    }
                                } else {
                                    $u.warn("Unable to find battle points text in tempDiv.parent().parent()");
                                }
                            } else {
                                $u.log(3, "Unable to find battle_rank_small_icon in caap.resultsWrapperDiv");
                            }

                            tempDiv = $j("b[class*='gold']", caap.resultsWrapperDiv).eq(0);
                            if ($u.hasContent(tempDiv)) {
                                tNum = $u.setContent(tempDiv.text(), '').trim().numberOnly();
                                if ($u.hasContent(tNum)) {
                                    result.gold = tNum;
                                } else {
                                    $u.warn("Unable to find gold text in tempDiv");
                                }
                            } else {
                                $u.warn("Unable to find gold element in caap.resultsWrapperDiv");
                            }

                            tempDiv = $j("a[href*='keep.php?casuser=']", caap.resultsWrapperDiv).eq(0);
                            if ($u.hasContent(tempDiv)) {
                                tempText = $u.setContent(tempDiv.attr("href"), '');
                                if ($u.hasContent(tempText)) {
                                    tNum = tempText.regex(/user=(\d+)/i);
                                    if ($u.hasContent(tNum)) {
                                        result.userId = tNum;
                                    } else {
                                        $u.warn("Unable to match user's id in", tempText);
                                        throw "Unable to get userId!";
                                    }

                                    tempText = $u.setContent(tempDiv.text(), '').trim();
                                    if ($u.hasContent(tempText)) {
                                        result.userName = tempText;
                                    } else {
                                        $u.warn("Unable to match user's name in", tempText);
                                    }
                                } else {
                                    $u.warn("No href text in tempDiv");
                                    throw "Unable to get userId!";
                                }
                            } else {
                                $u.warn("Unable to find keep.php?casuser= in caap.resultsWrapperDiv");
                                throw "Unable to get userId!";
                            }
                        } else {
                            $u.warn("Unable to find result div");
                            throw "Unable to get userId!";
                        }
                    } else {
                        $u.warn("Unable to determine battle type");
                        throw "Unable to get userId!";
                    }
                }

                battleRecord = battle.getItem(result.userId);
                battleRecord['attackTime'] = new Date().getTime();
                if (result.userName && result.userName !== battleRecord['nameStr']) {
                    $u.log(1, "Updating battle record user name, from/to", battleRecord['nameStr'], result.userName);
                    battleRecord['nameStr'] = result.userName;
                }

                if (result.win) {
                    battleRecord['statswinsNum'] += 1;
                } else {
                    battleRecord['statslossesNum'] += 1;
                }

                switch (result.battleType) {
                case 'Invade' :
                    if (result.win) {
                        battleRecord['invadewinsNum'] += 1;
                        battleRecord['ibp'] += result.points;
                    } else {
                        battleRecord['invadelossesNum'] += 1;
                        battleRecord['ibp'] -= result.points;
                        battleRecord['invadeLostTime'] = new Date().getTime();
                    }

                    break;
                case 'Duel' :
                    if (result.win) {
                        battleRecord['duelwinsNum'] += 1;
                        battleRecord['dbp'] += result.points;
                    } else {
                        battleRecord['duellossesNum'] += 1;
                        battleRecord['dbp'] -= result.points;
                        battleRecord['duelLostTime'] = new Date().getTime();
                    }

                    break;
                case 'War' :
                    if (result.win) {
                        battleRecord['warwinsNum'] += 1;
                        battleRecord['wbp'] += result.points;
                        $u.log(1, "War Win", battleRecord['warwinsNum']);
                    } else {
                        battleRecord['warlossesNum'] += 1;
                        battleRecord['wbp'] -= result.points;
                        battleRecord['warLostTime'] = new Date().getTime();
                        $u.log(1, "War Loss", battleRecord['userId'], battleRecord);
                    }

                    break;
                default :
                    $u.warn("Battle type unknown!", result.battleType);
                }

                battle.setItem(battleRecord);
                return result;
            } catch (err) {
                $u.error("ERROR in battle.getResult: " + err);
                return false;
            }
        },

        deadCheck: function () {
            try {
                var battleRecord = {},
                    dead         = false;

                if (state.getItem("lastBattleID", 0)) {
                    battleRecord = battle.getItem(state.getItem("lastBattleID", 0));
                }

                if ($u.hasContent(caap.resultsWrapperDiv)) {
                    if ($u.hasContent(caap.resultsText)) {
                        if (/Your opponent is dead or too weak to battle/.test(caap.resultsText)) {
                            $u.log(1, "This opponent is dead or hiding: ", state.getItem("lastBattleID", 0));
                            if ($j.isPlainObject(battleRecord) && !$j.isEmptyObject(battleRecord)) {
                                battleRecord['deadTime'] = new Date().getTime();
                            }

                            dead = true;
                        }
                    } else {
                        if ($j.isPlainObject(battleRecord) && !$j.isEmptyObject(battleRecord)) {
                            battleRecord['unknownTime'] = new Date().getTime();
                        }

                        $u.warn("Unable to determine if user is dead!");
                        dead = null;
                    }
                } else {
                    if ($j.isPlainObject(battleRecord) && !$j.isEmptyObject(battleRecord)) {
                        battleRecord['unknownTime'] = new Date().getTime();
                    }

                    $u.warn("Unable to find any results!");
                    dead = null;
                }

                if (dead !== false && $j.isPlainObject(battleRecord) && !$j.isEmptyObject(battleRecord)) {
                    battle.setItem(battleRecord);
                }

                return dead;
            } catch (err) {
                $u.error("ERROR in battle.deadCheck: " + err);
                return undefined;
            }
        },

        checkResults: function () {
            try {
                var battleRecord = {},
                    tempTime     = 0,
                    chainBP      = 0,
                    chainGold    = 0,
                    maxChains    = 0,
                    result       = {};

                if (!battle.flagResult) {
                    return true;
                }

                $u.log(2, "Checking Battle Results");
                battle.flagResult = false;
                state.setItem("BattleChainId", 0);
                if (battle.deadCheck() !== false) {
                    return true;
                }

                result = battle.getResult();
                if (!result || result.hiding === true) {
                    return true;
                }

                if (result.unknown === true) {
                    if (state.getItem("lastBattleID", 0)) {
                        battleRecord = battle.getItem(state.getItem("lastBattleID", 0));
                        battleRecord['unknownTime'] = new Date().getTime();
                        battle.setItem(battleRecord);
                    }

                    return true;
                }

                battleRecord = battle.getItem(result.userId);
                if (result.win) {
                    $u.log(1, "We Defeated ", result.userName, ((result.battleType === "War") ? "War Points: " : "Battle Points: ") + result.points + ", Gold: " + result.gold);
                    //Test if we should chain this guy
                    tempTime = $u.setContent(battleRecord['chainTime'], 0);
                    chainBP = config.getItem('ChainBP', '');
                    chainGold = config.getItem('ChainGold', '');
                    if (schedule.since(tempTime, 86400) && ((chainBP !== '' && !$u.isNaN(chainBP) && chainBP >= 0) || (chainGold !== '' && !$u.isNaN(chainGold) && chainGold >= 0))) {
                        if (chainBP !== '' && !$u.isNaN(chainBP) && chainBP >= 0) {
                            if (result.points >= chainBP) {
                                state.setItem("BattleChainId", result.userId);
                                $u.log(1, "Chain Attack:", result.userId, ((result.battleType === "War") ? "War Points: " : "Battle Points: ") + result.points);
                            } else {
                                battleRecord['ignoreTime'] = new Date().getTime();
                            }
                        }

                        if (chainGold !== '' && !$u.isNaN(chainGold) && chainGold >= 0) {
                            if (result.gold >= chainGold) {
                                state.setItem("BattleChainId", result.userId);
                                $u.log(1, "Chain Attack:", result.userId, "Gold: " + result.goldnum);
                            } else {
                                battleRecord['ignoreTime'] = new Date().getTime();
                            }
                        }
                    }

                    battleRecord['chainCount'] = battleRecord['chainCount'] ? battleRecord['chainCount'] += 1 : 1;
                    maxChains = config.getItem('MaxChains', 4);
                    if (maxChains === '' || $u.isNaN(maxChains) || maxChains < 0) {
                        maxChains = 4;
                    }

                    if (battleRecord['chainCount'] >= maxChains) {
                        $u.log(1, "Lets give this guy a break. Chained", battleRecord['chainCount']);
                        battleRecord['chainTime'] = new Date().getTime();
                        battleRecord['chainCount'] = 0;
                    }
                } else {
                    $u.log(1, "We Were Defeated By ", result.userName);
                    battleRecord['chainCount'] = 0;
                    battleRecord['chainTime'] = 0;
                }

                battle.setItem(battleRecord);
                return true;
            } catch (err) {
                $u.error("ERROR in battle.checkResults: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        nextTarget: function () {
            state.setItem('BattleTargetUpto', state.getItem('BattleTargetUpto', 0) + 1);
        },

        getTarget: function (mode) {
            try {
                var target     = '',
                    targets    = [],
                    battleUpto = '',
                    targetType = '',
                    targetRaid = '';

                targetType = config.getItem('TargetType', 'Freshmeat');
                targetRaid = state.getItem('targetFromraid', '');
                if (mode === 'DemiPoints') {
                    if (targetRaid && targetType === 'Raid') {
                        return 'Raid';
                    }

                    return 'Freshmeat';
                }

                if (targetType === 'Raid') {
                    if (targetRaid) {
                        return 'Raid';
                    }

                    caap.setDivContent('battle_mess', 'No Raid To Attack');
                    return 'NoRaid';
                }

                if (targetType === 'Freshmeat') {
                    return 'Freshmeat';
                }

                target = state.getItem('BattleChainId', 0);
                if (target) {
                    return target;
                }

                targets = config.getList('BattleTargets', '');
                if (!targets.length) {
                    return false;
                }

                battleUpto = state.getItem('BattleTargetUpto', 0);
                if (battleUpto > targets.length - 1) {
                    battleUpto = 0;
                    state.setItem('BattleTargetUpto', 0);
                }

                if (!targets[battleUpto]) {
                    battle.nextTarget();
                    return false;
                }

                caap.setDivContent('battle_mess', 'Battling User ' + battleUpto + '/' + targets.length + ' ' + targets[battleUpto]);
                if ((targets[battleUpto] === '' || $u.isNaN(targets[battleUpto]) ? targets[battleUpto].toLowerCase() : targets[battleUpto]) === 'raid') {
                    if (targetRaid) {
                        return 'Raid';
                    }

                    caap.setDivContent('battle_mess', 'No Raid To Attack');
                    battle.nextTarget();
                    return false;
                }

                return targets[battleUpto];
            } catch (err) {
                $u.error("ERROR in battle.getTarget: " + err);
                return false;
            }
        },

        click: function (battleButton, type) {
            try {
                state.setItem('ReleaseControl', true);
                battle.flagResult = true;
                state.setItem('clickUrl', caap.domain.link + '/' + (type === 'Raid' ? 'raid.php' : 'battle.php'));
                caap.click(battleButton);
                return true;
            } catch (err) {
                $u.error("ERROR in battle.click: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        battles: {
            'Raid' : {
                'Invade1'  : 'raid_attack_button.gif',
                'Invade5'  : 'raid_attack_button3.gif',
                'Duel1'    : 'raid_attack_button2.gif',
                'Duel5'    : 'raid_attack_button4.gif',
                'regex1'   : new RegExp('[0-9]+\\. (.+)\\s*Rank: ([0-9]+) ([^0-9]+) ([0-9]+) ([^0-9]+) ([0-9]+)', 'i'),
                'refresh'  : 'raid',
                'image'    : 'tab_raid_on.gif'
            },
            'Freshmeat' : {
                'Invade'   : 'battle_01.gif',
                'Duel'     : 'battle_02.gif',
                'War'      : 'war_button_duel.gif',
                'regex1'   : new RegExp('(.+)\\s*\\(Level ([0-9]+)\\)\\s*Battle: ([A-Za-z ]+) \\(Rank ([0-9]+)\\)\\s*War: ([A-Za-z ]+) \\(Rank ([0-9]+)\\)\\s*([0-9]+)', 'i'),
                'regex2'   : new RegExp('(.+)\\s*\\(Level ([0-9]+)\\)\\s*Battle: ([A-Za-z ]+) \\(Rank ([0-9]+)\\)\\s*([0-9]+)', 'i'),
                'warLevel' : true,
                'refresh'  : 'battle_on.gif',
                'image'    : 'battle_on.gif'
            }
        },

        selectedDemisDone: function (force) {
            try {
                var demiPointsDone = true,
                    it = 0;

                for (it = 0; it < 5; it += 1) {
                    if (force || config.getItem('DemiPoint' + it, true)) {
                        if (caap.demi[caap.demiTable[it]]['daily']['dif'] > 0) {
                            demiPointsDone = false;
                            break;
                        }
                    }
                }

                return demiPointsDone;
            } catch (err) {
                $u.error("ERROR in battle.selectedDemisDone: " + err);
                return undefined;
            }
        },

        freshmeat: function (type) {
            try {
                var buttonType      = type === 'Raid' ? config.getItem('BattleType', 'Invade') + state.getItem('RaidStaminaReq', 1) : config.getItem('BattleType', 'Invade'),
                    inputDiv        = $j("input[src*='" + battle.battles[type][buttonType] + "']", caap.appBodyDiv),
                    plusOneSafe     = false,
                    safeTargets     = [],
                    chainId         = '',
                    chainAttack     = false,
                    inp             = $j(),
                    txt             = '',
                    minRank         = 0,
                    maxLevel        = 0,
                    ARBase          = 0,
                    ARMax           = 0,
                    ARMin           = 0,
                    levelMultiplier = 0,
                    armyRatio       = 0,
                    battleRecord    = {},
                    it              = 0,
                    itx,
                    len             = 0,
                    form            = $j(),
                    firstId         = '',
                    lastBattleID    = 0,
                    engageButton    = null,
                    time            = 0;

                if (!$u.hasContent(inputDiv)) {
                    $u.warn('Not on battlepage');
                    caap.navigateTo(caap.battlePage);
                    return false;
                }

                chainId = state.getItem('BattleChainId', 0);
                state.setItem('BattleChainId', '');
                // Lets get our Freshmeat user settings
                minRank = config.getItem("FreshMeatMinRank", 99);
                $u.log(3, "FreshMeatMinRank", minRank);
                if (minRank === '' || $u.isNaN(minRank)) {
                    if (minRank !== '') {
                        $u.warn("FreshMeatMinRank is NaN, using default", 99);
                    }

                    minRank = 99;
                }

                maxLevel = config.getItem("FreshMeatMaxLevel", 99999);
                $u.log(3, "FreshMeatMaxLevel", maxLevel);
                if (maxLevel === '' || $u.isNaN(maxLevel)) {
                    if (maxLevel !== '') {
                        $u.warn("FreshMeatMaxLevel is NaN, using default", maxLevel);
                    }

                    maxLevel = 99999;
                }

                ARBase = config.getItem("FreshMeatARBase", 0.5);
                $u.log(3, "FreshMeatARBase", ARBase);
                if (ARBase === '' || $u.isNaN(ARBase)) {
                    if (ARBase !== '') {
                        $u.warn("FreshMeatARBase is NaN, using default", ARBase);
                    }

                    ARBase = 0.5;
                }

                ARMax = config.getItem("FreshMeatARMax", 99999);
                $u.log(3, "FreshMeatARMax", ARMax);
                if (ARMax === '' || $u.isNaN(ARMax)) {
                    if (ARMax !== '') {
                        $u.warn("FreshMeatARMax is NaN, using default", ARMax);
                    }

                    ARMax = 99999;
                }

                ARMin = config.getItem("FreshMeatARMin", 0);
                $u.log(3, "FreshMeatARMin", ARMin);
                if (ARMin === '' || $u.isNaN(ARMin)) {
                    if (ARMin !== '') {
                        $u.warn("FreshMeatARMin is NaN, using default", ARMin);
                    }

                    ARMin = 0;
                }

                inputDiv.each(function (index) {
                    var tr         = $j(),
                        levelm     = [],
                        tempTxt    = '',
                        tNum       = 0,
                        tempTime   = -1,
                        tempRecord = new battle.record();

                    tempRecord.data['button'] = $j(this);
                    if (type === 'Raid') {
                        tr = tempRecord.data['button'].parents().eq(4);
                        tempTxt = $u.setContent(tr.children().eq(1).text(), '').trim();
                        levelm = battle.battles['Raid']['regex1'].exec(tempTxt);
                        if (!$u.hasContent(levelm)) {
                            $u.warn("Can't match Raid regex in ", tempTxt);
                            return true;
                        }

                        tempRecord.data['nameStr'] = $u.setContent(levelm[1], '').trim();
                        tempRecord.data['rankNum'] = $u.setContent(levelm[2], '').parseInt();
                        tempRecord.data['rankStr'] = battle.battleRankTable[tempRecord.data['rankNum']];
                        tempRecord.data['levelNum'] = $u.setContent(levelm[4], '').parseInt();
                        tempRecord.data['armyNum'] = $u.setContent(levelm[6], '').parseInt();
                    } else {
                        tr = tempRecord.data['button'].parents("tr").eq(0);
                        if (!$u.hasContent(tr)) {
                            $u.warn("Can't find parent tr in tempRecord.data['button']");
                            return true;
                        }

                        tNum = $u.setContent($j("img[src*='symbol_']", tr).attr("src"), '').regex(/(\d+)\.jpg/i);
                        if ($u.hasContent(tNum)) {
                            tempRecord.data['deityNum'] = tNum - 1;
                            if (tempRecord.data['deityNum'] >= 0 && tempRecord.data['deityNum'] <= 4) {
                                tempRecord.data['deityStr'] = caap.demiTable[tempRecord.data['deityNum']];
                            } else {
                                $u.warn("Demi number is not between 0 and 4", tempRecord.data['deityNum']);
                                tempRecord.data['deityNum'] = 0;
                                tempRecord.data['deityStr'] = caap.demiTable[tempRecord.data['deityNum']];
                            }
                        } else {
                            $u.warn("Unable to match demi number in tempTxt");
                        }

                        // If looking for demi points, and already full, continue
                        if (config.getItem('DemiPointsFirst', false) && !state.getItem('DemiPointsDone', true) && (config.getItem('WhenMonster', 'Never') !== 'Never')) {
                            if (caap.demi[tempRecord.data['deityStr']]['daily']['dif'] <= 0 || !config.getItem('DemiPoint' + tempRecord.data['deityNum'], true)) {
                                $u.log(2, "Daily Demi Points done for", tempRecord.data['deityStr']);
                                return true;
                            }
                        } else if (config.getItem('WhenBattle', 'Never') === "Demi Points Only") {
                            if (caap.demi[tempRecord.data['deityStr']]['daily']['dif'] <= 0) {
                                $u.log(2, "Daily Demi Points done for", tempRecord.data['deityStr']);
                                return true;
                            }
                        }

                        tempTxt = $u.setContent(tr.text(), '').trim();
                        if (!$u.hasContent(tempTxt)) {
                            $u.warn("Can't find tempTxt in tr");
                            return true;
                        }

                        if (battle.battles['Freshmeat']['warLevel']) {
                            levelm = battle.battles['Freshmeat']['regex1'].exec(tempTxt);
                            if (!levelm) {
                                levelm = battle.battles['Freshmeat']['regex2'].exec(tempTxt);
                                battle.battles['Freshmeat']['warLevel'] = false;
                            }
                        } else {
                            levelm = battle.battles['Freshmeat']['regex2'].exec(tempTxt);
                            if (!levelm) {
                                levelm = battle.battles['Freshmeat']['regex1'].exec(tempTxt);
                                battle.battles['Freshmeat']['warLevel'] = true;
                            }
                        }

                        if (!levelm) {
                            $u.warn("Can't match Freshmeat regex in ", tempTxt);
                            return true;
                        }

                        tempRecord.data['nameStr'] = $u.setContent(levelm[1], '').trim();
                        tempRecord.data['levelNum'] = $u.setContent(levelm[2], '').parseInt();
                        tempRecord.data['rankStr'] = $u.setContent(levelm[3], '').trim();
                        tempRecord.data['rankNum'] = $u.setContent(levelm[4], '').parseInt();
                        if (battle.battles['Freshmeat']['warLevel']) {
                            tempRecord.data['warRankStr'] = $u.setContent(levelm[5], '').trim();
                            tempRecord.data['warRankNum'] = $u.setContent(levelm[6], '').parseInt();
                            tempRecord.data['armyNum'] = $u.setContent(levelm[7], '').parseInt();
                        } else {
                            tempRecord.data['armyNum'] = $u.setContent(levelm[5], '').parseInt();
                        }
                    }

                    inp = $j("input[name='target_id']", tr);
                    if (!$u.hasContent(inp)) {
                        $u.warn("Could not find 'target_id' input");
                        return true;
                    }

                    tempRecord.data['userId'] = $u.setContent(inp.attr("value"), '').parseInt();
                    if (battle.hashCheck(tempRecord.data)) {
                        return true;
                    }

                    levelMultiplier = caap.stats['level'] / (tempRecord.data['levelNum'] > 0 ? tempRecord.data['levelNum'] : 1);
                    armyRatio = ARBase * levelMultiplier;
                    armyRatio = Math.min(armyRatio, ARMax);
                    armyRatio = Math.max(armyRatio, ARMin);
                    if (armyRatio <= 0) {
                        $u.warn("Bad ratio", armyRatio, ARBase, ARMin, ARMax, levelMultiplier);
                        return true;
                    }

                    if (tempRecord.data['levelNum'] - caap.stats['level'] > maxLevel) {
                        $u.log(2, "Greater than maxLevel", {'levelDif': tempRecord.data['levelNum'] - caap.stats['level'], 'maxLevel': maxLevel});
                        return true;
                    }

                    if (config.getItem("BattleType", 'Invade') === "War" && battle.battles['Freshmeat']['warLevel']) {
                        if (caap.stats['rank']['war'] && (caap.stats['rank']['war'] - tempRecord.data['warRankNum'] > minRank)) {
                            $u.log(2, "Greater than war minRank", {'rankDif': caap.stats['rank']['war'] - tempRecord.data['warRankNum'], 'minRank': minRank});
                            return true;
                        }
                    } else {
                        if (caap.stats['rank']['battle'] && (caap.stats['rank']['battle'] - tempRecord.data['rankNum'] > minRank)) {
                            $u.log(2, "Greater than battle minRank", {'rankDif': caap.stats['rank']['battle'] - tempRecord.data['rankNum'], 'minRank': minRank});
                            return true;
                        }
                    }

                    // if we know our army size, and this one is larger than armyRatio, don't battle
                    if (caap.stats['army']['capped'] && (tempRecord.data['armyNum'] > (caap.stats['army']['capped'] * armyRatio))) {
                        $u.log(2, "Greater than armyRatio", {'armyRatio': armyRatio.dp(2), 'armyNum': tempRecord.data['armyNum'], 'armyMax': (caap.stats['army']['capped'] * armyRatio).dp()});
                        return true;
                    }

                    if (config.getItem("BattleType", 'Invade') === "War" && battle.battles['Freshmeat']['warLevel']) {
                        $u.log(1, "ID: " + tempRecord.data['userId'].toString().rpad(" ", 15) +
                                    " Level: " + tempRecord.data['levelNum'].toString().rpad(" ", 4) +
                                    " War Rank: " + tempRecord.data['warRankNum'].toString().rpad(" ", 2) +
                                    " Army: " + tempRecord.data['armyNum']);
                    } else {
                        $u.log(1, "ID: " + tempRecord.data['userId'].toString().rpad(" ", 15) +
                                    " Level: " + tempRecord.data['levelNum'].toString().rpad(" ", 4) +
                                    " Battle Rank: " + tempRecord.data['rankNum'].toString().rpad(" ", 2) +
                                    " Army: " + tempRecord.data['armyNum']);
                    }

                    // don't battle people we lost to in the last week
                    battleRecord = battle.getItem(tempRecord.data['userId']);
                    if (!config.getItem("IgnoreBattleLoss", false)) {
                        switch (config.getItem("BattleType", 'Invade')) {
                        case 'Invade' :
                            tempTime = $u.setContent(battleRecord['invadeLostTime'], 0);
                            break;
                        case 'Duel' :
                            tempTime = $u.setContent(battleRecord['duelLostTime'], 0);
                            break;
                        case 'War' :
                            tempTime = $u.setContent(battleRecord['warLostTime'], 0);
                            break;
                        default :
                            $u.warn("Battle type unknown!", config.getItem("BattleType", 'Invade'));
                        }

                        if (battleRecord && !battleRecord['newRecord'] && tempTime && !schedule.since(tempTime, 604800)) {
                            $u.log(1, "We lost " + config.getItem("BattleType", 'Invade') + " to this id this week: ", tempRecord.data['userId']);
                            return true;
                        }
                    }

                    // don't battle people that results were unknown in the last hour
                    tempTime = $u.setContent(battleRecord['unknownTime'], 0);
                    if (battleRecord && !battleRecord['newRecord'] && !schedule.since(tempTime, 3600)) {
                        $u.log(1, "User was battled but results unknown in the last hour: ", tempRecord.data['userId']);
                        return true;
                    }

                    // don't battle people that were dead or hiding in the last hour
                    tempTime = $u.setContent(battleRecord['deadTime'], 0);
                    if (battleRecord && !battleRecord['newRecord'] && !schedule.since(tempTime, 3600)) {
                        $u.log(1, "User was dead in the last hour: ", tempRecord.data['userId']);
                        return true;
                    }

                    // don't battle people we've already chained to max in the last 2 days
                    tempTime = $u.setContent(battleRecord['chainTime'], 0);
                    if (battleRecord && !battleRecord['newRecord'] && !schedule.since(tempTime, 86400)) {
                        $u.log(1, "We chained user within 2 days: ", tempRecord.data['userId']);
                        return true;
                    }

                    // don't battle people that didn't meet chain gold or chain points in the last week
                    tempTime = $u.setContent(battleRecord['ignoreTime'], 0);
                    if (battleRecord && !battleRecord['newRecord'] && !schedule.since(tempTime, 604800)) {
                        $u.log(1, "User didn't meet chain requirements this week: ", tempRecord.data['userId']);
                        return true;
                    }

                    tempRecord.data['score'] = (type === 'Raid' ? 0 : tempRecord.data['rankNum']) - (tempRecord.data['armyNum'] / levelMultiplier / caap.stats['army']['capped']);
                    if (tempRecord.data['userId'] === chainId) {
                        chainAttack = true;
                    }

                    tempRecord.data['targetNumber'] = index + 1;
                    $u.log(3, "tempRecord/levelm", tempRecord.data, levelm);
                    safeTargets.push(tempRecord.data);
                    tempRecord = null;
                    if (index === 0 && type === 'Raid') {
                        plusOneSafe = true;
                    }

                    return true;
                });

                safeTargets.sort($u.sortBy(true, "score"));
                if ($u.hasContent(safeTargets)) {
                    if (chainAttack) {
                        form = inputDiv.eq(0).parent().parent();
                        inp = $j("input[name='target_id']", form);
                        if ($u.hasContent(inp)) {
                            inp.attr("value", chainId);
                            $u.log(1, "Chain attacking: ", chainId);
                            battle.click(inputDiv.eq(0), type);
                            state.setItem("lastBattleID", chainId);
                            caap.setDivContent('battle_mess', 'Attacked: ' + state.getItem("lastBattleID", 0));
                            state.setItem("notSafeCount", 0);
                            return true;
                        }

                        $u.warn("Could not find 'target_id' input");
                    } else if (config.getItem('PlusOneKills', false) && type === 'Raid') {
                        if (plusOneSafe) {
                            form = inputDiv.eq(0).parent().parent();
                            inp = $j("input[name='target_id']", form);
                            if ($u.hasContent(inp)) {
                                txt = inp.attr("value");
                                firstId = txt ? txt.parseInt() : 0;
                                inp.attr("value", '200000000000001');
                                $u.log(1, "Target ID Overriden For +1 Kill. Expected Defender: ", firstId);
                                battle.click(inputDiv.eq(0), type);
                                state.setItem("lastBattleID", firstId);
                                caap.setDivContent('battle_mess', 'Attacked: ' + state.getItem("lastBattleID", 0));
                                state.setItem("notSafeCount", 0);
                                return true;
                            }

                            $u.warn("Could not find 'target_id' input");
                        } else {
                            $u.log(1, "Not safe for +1 kill.");
                        }
                    } else {
                        lastBattleID = state.getItem("lastBattleID", 0);
                        for (it = 0, len = safeTargets.length; it < len; it += 1) {
                            if (!lastBattleID && lastBattleID === safeTargets[it]['id']) {
                                continue;
                            }

                            if ($u.isDefined(safeTargets[it]['button'])) {
                                $u.log(2, 'Found Target score: ' + safeTargets[it]['score'].dp(2) + ' id: ' + safeTargets[it]['userId'] + ' Number: ' + safeTargets[it]['targetNumber']);
                                battle.click(safeTargets[it]['button'], type);
                                delete safeTargets[it]['score'];
                                delete safeTargets[it]['targetNumber'];
                                delete safeTargets[it]['button'];
                                battleRecord = battle.getItem(safeTargets[it]['userId']);
                                if (battleRecord['newRecord']) {
                                    state.setItem("lastBattleID", safeTargets[it]['userId']);
                                    $j.extend(true, battleRecord, safeTargets[it]);
                                    battleRecord['newRecord'] = false;
                                    battleRecord['aliveTime'] = new Date().getTime();
                                } else {
                                    battleRecord['aliveTime'] = new Date().getTime();
                                    for (itx in safeTargets[it]) {
                                        if (safeTargets[it].hasOwnProperty(itx)) {
                                            if (!$u.hasContent(battleRecord[itx] && $u.hasContent(safeTargets[it][itx]))) {
                                                battleRecord[itx] = safeTargets[it][itx];
                                            }

                                            if ($u.hasContent(safeTargets[it][itx]) && $u.isString(safeTargets[it][itx]) && battleRecord[itx] !== safeTargets[it][itx]) {
                                                battleRecord[itx] = safeTargets[it][itx];
                                            }

                                            if ($u.hasContent(safeTargets[it][itx]) && $u.isNumber(safeTargets[it][itx]) && battleRecord[itx] < safeTargets[it][itx]) {
                                                battleRecord[itx] = safeTargets[it][itx];
                                            }
                                        }
                                    }
                                }

                                battle.setItem(battleRecord);
                                caap.setDivContent('battle_mess', 'Attacked: ' + lastBattleID);
                                state.setItem("notSafeCount", 0);
                                return true;
                            }

                            $u.warn('Attack button is null or undefined');
                        }
                    }
                }

                state.setItem("notSafeCount", state.getItem("notSafeCount", 0) + 1);
                // add a schedule here for 5 mins or so
                if (state.getItem("notSafeCount", 0) > 20) {
                    caap.setDivContent('battle_mess', 'Leaving Battle. Will Return Soon.');
                    $u.log(1, 'No safe targets limit reached. Releasing control for other processes: ', state.getItem("notSafeCount", 0));
                    state.setItem("notSafeCount", 0);
                    return false;
                }

                caap.setDivContent('battle_mess', 'No targets matching criteria');
                $u.log(1, 'No safe targets: ', state.getItem("notSafeCount", 0));

                if (type === 'Raid') {
                    engageButton = monster.engageButtons[state.getItem('targetFromraid', '')];
                    if (state.getItem("page", '') === 'raid' && engageButton) {
                        caap.click(engageButton);
                    } else {
                        time = config.getItem("RaidNoTargetDelay", 45);
                        time = time < 10 ? 10 : time;
                        schedule.setItem("RaidNoTargetDelay", time);
                        caap.navigateTo(caap.battlePage + ',raid');
                    }
                } else {
                    caap.navigateTo(caap.battlePage + ',battle_on.gif');
                }

                return true;
            } catch (err) {
                $u.error("ERROR in battle.freshmeat: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        menu: function () {
            try {
                var XBattleInstructions = "Start battling if stamina is above this points",
                    XMinBattleInstructions = "Don't battle if stamina is below this points",
                    safeHealthInstructions = "Wait until health is 13 instead of 10, prevents you killing yourself but leaves you unhidden for upto 15 minutes",
                    userIdInstructions = "User IDs(not user name).  Click with the " +
                        "right mouse button on the link to the users profile & copy link." +
                        "  Then paste it here and remove everything but the last numbers." +
                        " (ie. 123456789)",
                    chainBPInstructions = "Number of battle points won to initiate a chain attack. Specify 0 to always chain attack.",
                    chainGoldInstructions = "Amount of gold won to initiate a chain attack. Specify 0 to always chain attack.",
                    maxChainsInstructions = "Maximum number of chain hits after the initial attack.",
                    FMRankInstructions = "The lowest relative rank below yours that " +
                        "you are willing to spend your stamina on. Leave blank to attack " +
                        "any rank. (Uses Battle Rank for invade and duel, War Rank for wars.)",
                    FMARBaseInstructions = "This value sets the base for your Army " +
                        "Ratio calculation [X * (Your Army Size/ Opponent Army Size)]. It is basically a multiplier for the army " +
                        "size of a player at your equal level. A value of 1 means you " +
                        "will battle an opponent the same level as you with an army the " +
                        "same size as you or less. Default .5",
                    FreshMeatARMaxInstructions = "This setting sets the highest value you will use for the Army Ratio [Math.min(Army Ratio, Army Ratio Max)] value. So, if you NEVER want to fight an army bigger than 80% your size, you can set the Max value to .8.",
                    FreshMeatARMinInstructions = "This setting sets the lowest value you will use for the Army Ratio [Math.max(Army Ratio, Army Ratio Min)] value. So, if you NEVER want to pass up an army that is less than 10% the size of yours, you can set MIN value to .1.",
                    FreshMeatMaxLevelInstructions = "This setting sets the highest level above you that you are willing to attack. So if you are a level 100 and do not want to attack an opponent above level 120, you can code 20.",
                    plusonekillsInstructions = "Force +1 kill scenario if 80% or more" +
                        " of targets are withn freshmeat settings. Note: Since Castle Age" +
                        " choses the target, selecting this option could result in a " +
                        "greater chance of loss.",
                    raidPowerAttackInstructions = "Attack raids using the x5 button. (Not recommended).",
                    raidOrderInstructions = "List of search words that decide which " +
                        "raids to participate in first.  Use words in player name or in " +
                        "raid name. To specify max damage follow keyword with :max token " +
                        "and specifiy max damage values. Use 'k' and 'm' suffixes for " +
                        "thousand and million.",
                    ignorebattlelossInstructions = "Ignore battle losses and attack " +
                        "regardless.  This will also delete all battle loss records.",
                    battleList = [
                        'Stamina Available',
                        'At Max Stamina',
                        'At X Stamina',
                        'No Monster',
                        'Stay Hidden',
                        'Demi Points Only',
                        'Never'
                    ],
                    battleInst = [
                        'Stamina Available will battle whenever you have enough stamina',
                        'At Max Stamina will battle when stamina is at max and will burn down all stamina when able to level up',
                        'At X Stamina you can set maximum and minimum stamina to battle',
                        'No Monster will battle only when there are no active monster battles or if Get Demi Points First has been selected.',
                        'Stay Hidden uses stamina to try to keep you under 10 health so you cannot be attacked, while also attempting to maximize your stamina use for Monster attacks. YOU MUST SET MONSTER TO "STAY HIDDEN" TO USE THIS FEATURE.',
                        'Demi Points Only will battle only when Daily Demi Points are required, can use in conjunction with Get Demi Points First. Does not work with War.',
                        'Never - disables player battles'
                    ],
                    typeList = [
                        'Invade',
                        'Duel',
                        'War'
                    ],
                    typeInst = [
                        'Battle using Invade button',
                        'Battle using Duel button - no guarentee you will win though',
                        'War using Duel button - no guarentee you will win though'
                    ],
                    targetList = [
                        'Freshmeat',
                        'Userid List',
                        'Raid'
                    ],
                    targetInst = [
                        'Use settings to select a target from the Battle Page',
                        'Select target from the supplied list of userids',
                        'Raid Battles'
                    ],
                    dosiegeInstructions = "(EXPERIMENTAL) Turns on or off automatic siege assist for all raids only.",
                    collectRewardInstructions = "(EXPERIMENTAL) Automatically collect raid rewards.",
                    observeDemiFirstInstructions = "If you are setting Get demi Points First and No Attack If % Under in Monster then enabling this option " +
                        "will cause Demi Points Only to observe the Demi Points requested in the case where No Attack If % Under is triggered.",
                    htmlCode = '';

                htmlCode = caap.startToggle('Battling', 'BATTLE');
                htmlCode += caap.makeDropDownTR("Battle When", 'WhenBattle', battleList, battleInst, '', 'Never', false, false, 62);
                htmlCode += caap.startDropHide('WhenBattle', '', 'Never', true);
                htmlCode += "<div id='caap_WhenBattleStayHidden_hide' style='color: red; font-weight: bold; display: ";
                htmlCode += (config.getItem('WhenBattle', 'Never') === 'Stay Hidden' && config.getItem('WhenMonster', 'Never') !== 'Stay Hidden' ? 'block' : 'none') + "'>";
                htmlCode += "Warning: Monster Not Set To 'Stay Hidden'";
                htmlCode += "</div>";
                htmlCode += caap.startDropHide('WhenBattle', 'XStamina', 'At X Stamina', false);
                htmlCode += caap.makeNumberFormTR("Start At Or Above", 'XBattleStamina', XBattleInstructions, 1, '', '', true, false);
                htmlCode += caap.makeNumberFormTR("Stop At Or Below", 'XMinBattleStamina', XMinBattleInstructions, 0, '', '', true, false);
                htmlCode += caap.endDropHide('WhenBattle', 'XStamina');
                htmlCode += caap.startDropHide('WhenBattle', 'DemiOnly', 'Demi Points Only', false);
                htmlCode += caap.makeCheckTR("Observe Get Demi Points First", 'observeDemiFirst', false, observeDemiFirstInstructions);
                htmlCode += caap.endDropHide('WhenBattle', 'DemiOnly');
                htmlCode += caap.makeDropDownTR("Battle Type", 'BattleType', typeList, typeInst, '', '', false, false, 62);
                htmlCode += caap.makeCheckTR("Wait For Safe Health", 'waitSafeHealth', false, safeHealthInstructions);
                htmlCode += caap.makeCheckTR("Siege Weapon Assist Raids", 'raidDoSiege', true, dosiegeInstructions);
                htmlCode += caap.makeCheckTR("Collect Raid Rewards", 'raidCollectReward', false, collectRewardInstructions);
                htmlCode += caap.makeCheckTR("Clear Complete Raids", 'clearCompleteRaids', false, '');
                htmlCode += caap.makeCheckTR("Ignore Battle Losses", 'IgnoreBattleLoss', false, ignorebattlelossInstructions);
                htmlCode += caap.makeNumberFormTR("Chain Battle Points", 'ChainBP', chainBPInstructions, '', '');
                htmlCode += caap.makeNumberFormTR("Chain Gold", 'ChainGold', chainGoldInstructions, '', '', '', false, false, 30);
                htmlCode += caap.makeNumberFormTR("Max Chains", 'MaxChains', maxChainsInstructions, 4, '', '');
                htmlCode += caap.makeTD("Attack targets that are not:");
                htmlCode += caap.makeNumberFormTR("Lower Than Rank Minus", 'FreshMeatMinRank', FMRankInstructions, '', '', '');
                htmlCode += caap.makeNumberFormTR("Higher Than X*AR", 'FreshMeatARBase', FMARBaseInstructions, 0.5, '', '');
                htmlCode += caap.makeCheckTR('Advanced', 'AdvancedFreshMeatOptions', false);
                htmlCode += caap.startCheckHide('AdvancedFreshMeatOptions');
                htmlCode += caap.makeNumberFormTR("Max Level", 'FreshMeatMaxLevel', FreshMeatMaxLevelInstructions, '', '', '', true);
                htmlCode += caap.makeNumberFormTR("Army Ratio Max", 'FreshMeatARMax', FreshMeatARMaxInstructions, '', '', '', true);
                htmlCode += caap.makeNumberFormTR("Army Ratio Min", 'FreshMeatARMin', FreshMeatARMinInstructions, '', '', '', true);
                htmlCode += caap.endCheckHide('AdvancedFreshMeatOptions');
                htmlCode += caap.makeDropDownTR("Target Type", 'TargetType', targetList, targetInst, '', '', false, false, 62);
                htmlCode += caap.startDropHide('TargetType', 'Raid', 'Raid', false);
                htmlCode += caap.makeCheckTR("Power Attack", 'RaidPowerAttack', false, raidPowerAttackInstructions, true);
                htmlCode += caap.makeCheckTR("Attempt +1 Kills", 'PlusOneKills', false, plusonekillsInstructions, true);
                htmlCode += caap.makeTD("Join Raids in this order <a href='http://senses.ws/caap/index.php?topic=1502.0' target='_blank' style='color: blue'>(INFO)</a>");
                htmlCode += caap.makeTextBox('orderraid', raidOrderInstructions, '');
                htmlCode += caap.endDropHide('TargetType', 'Raid');
                htmlCode += caap.startDropHide('TargetType', 'UserId', 'Userid List', false);
                htmlCode += caap.makeTextBox('BattleTargets', userIdInstructions, '');
                htmlCode += caap.endDropHide('TargetType', 'UserId');
                htmlCode += caap.endDropHide('WhenBattle');
                htmlCode += caap.makeCheckTR("Modify Timers", 'battleModifyTimers', false, "Advanced timers for how often Battle functions are performed.");
                htmlCode += caap.startCheckHide('battleModifyTimers');
                htmlCode += caap.makeNumberFormTR("Raid scan seconds", 'RaidNoTargetDelay', "Check the Raid every X seconds when no target available. Minimum 10.", 45, '', '', true);
                htmlCode += caap.endCheckHide('battleModifyTimers');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in battle.menu: " + err);
                return '';
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        dashboard: function () {
            try {
                function points(num) {
                    num = $u.setContent(num, 0);
                    return num >= 0 ? "+" + num : num;
                }

                /*-------------------------------------------------------------------------------------\
                Next we build the HTML to be included into the 'caap_infoBattle' div. We set our
                table and then build the header row.
                \-------------------------------------------------------------------------------------*/
                if (config.getItem('DBDisplay', '') === 'Battle Stats' && state.getItem("BattleDashUpdate", true)) {
                    var headers                 = ['UserId', 'Name',    'BR',     'WR',        'Level',    'Army',    'Invade',           'Duel',        'War'],
                        values                  = ['userId', 'nameStr', 'rankNum', 'warRankNum', 'levelNum', 'armyNum', 'invadewinsNum', 'duelwinsNum', 'warwinsNum'],
                        pp                      = 0,
                        i                       = 0,
                        userIdLink              = '',
                        userIdLinkInstructions  = '',
                        len                     = 0,
                        len1                    = 0,
                        data                    = {text: '', color: '', bgcolor: '', id: '', title: ''},
                        head                    = '',
                        body                    = '',
                        row                     = '';

                    for (pp = 0; pp < headers.length; pp += 1) {
                        switch (headers[pp]) {
                        case 'UserId':
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '16%'});
                            break;
                        case 'Name':
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '30%'});
                            break;
                        case 'Invade':
                        case 'Duel':
                        case 'War':
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '10%'});
                            break;
                        case 'BR':
                        case 'WR':
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '5%'});
                            break;
                        default:
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '7%'});
                        }
                    }

                    head = caap.makeTr(head);
                    for (i = 0, len = battle.records.length; i < len; i += 1) {
                        row = "";
                        for (pp = 0, len1 = values.length; pp < len1; pp += 1) {
                            switch (values[pp]) {
                            case 'userId':
                                userIdLinkInstructions = "Clicking this link will take you to the user keep of " + battle.records[i][values[pp]];
                                userIdLink = caap.domain.link + "/keep.php?casuser=" + battle.records[i][values[pp]];
                                data = {
                                    text  : '<span id="caap_battle_' + i + '" title="' + userIdLinkInstructions + '" rlink="' + userIdLink +
                                            '" onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';">' + battle.records[i][values[pp]] + '</span>',
                                    color : 'blue',
                                    id    : '',
                                    title : ''
                                };

                                row += caap.makeTd(data);
                                break;
                            case 'rankNum':
                                row += caap.makeTd({text: battle.records[i][values[pp]], color: '', id: '', title: battle.records[i]['rankStr']});
                                break;
                            case 'warRankNum':
                                row += caap.makeTd({text: battle.records[i][values[pp]], color: '', id: '', title: battle.records[i]['warRankStr']});
                                break;
                            case 'invadewinsNum':
                                row += caap.makeTd({text: battle.records[i][values[pp]] + "/" + battle.records[i]['invadelossesNum'] + " " + points(battle.records[i]['ibp']), color: '', id: '', title: ''});
                                break;
                            case 'duelwinsNum':
                                row += caap.makeTd({text: battle.records[i][values[pp]] + "/" + battle.records[i]['duellossesNum'] + " " + points(battle.records[i]['dbp']), color: '', id: '', title: ''});
                                break;
                            case 'warwinsNum':
                                row += caap.makeTd({text: battle.records[i][values[pp]] + "/" + battle.records[i]['warlossesNum'] + " " + points(battle.records[i]['wbp']), color: '', id: '', title: ''});
                                break;
                            default:
                                row += caap.makeTd({text: battle.records[i][values[pp]], color: '', id: '', title: ''});
                            }
                        }

                        body += caap.makeTr(row);
                    }

                    $j("#caap_infoBattle", caap.caapTopObject).html(
                        $j(caap.makeTable("battle", head, body)).dataTable({
                            "bAutoWidth"    : false,
                            "bFilter"       : false,
                            "bJQueryUI"     : false,
                            "bInfo"         : false,
                            "bLengthChange" : false,
                            "bPaginate"     : false,
                            "bProcessing"   : false,
                            "bStateSave"    : true,
                            "bSortClasses"  : false
                        })
                    );

                    $j("span[id*='caap_battle_']", caap.caapTopObject).click(function (e) {
                        var visitUserIdLink = {
                                rlink     : '',
                                arlink    : ''
                            },
                            i   = 0,
                            len = 0;

                        for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                            if (e.target.attributes[i].nodeName === 'rlink') {
                                visitUserIdLink.rlink = e.target.attributes[i].nodeValue;
                                visitUserIdLink.arlink = visitUserIdLink.rlink.replace(caap.domain.link + "/", "");
                            }
                        }

                        caap.clickAjaxLinkSend(visitUserIdLink.arlink);
                    });

                    state.setItem("BattleDashUpdate", false);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in battle.dashboard: " + err);
                return false;
            }
        }
        /*jslint sub: false */
    };

    ////////////////////////////////////////////////////////////////////
    //                          town OBJECT
    // this is the main object for dealing with town items
    /////////////////////////////////////////////////////////////////////

    town = {
        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        'soldiers': [],

        'item': [],

        'magic': [],

        record: function () {
            this.data = {
                'name'   : '',
                'image'  : '',
                'type'   : '',
                'upkeep' : 0,
                'hourly' : 0,
                'atk'    : 0,
                'def'    : 0,
                'owned'  : 0,
                'cost'   : 0,
                'api'    : 0,
                'dpi'    : 0,
                'mpi'    : 0
            };
        },

        types: ['soldiers', 'item', 'magic'],
        /*jslint sub: false */

        soldiershbest: 3,

        itemhbest: 2,

        magichbest: 2,

        load: function (type) {
            try {
                if (!$u.isString(type) || type === '' || !town.types.hasIndexOf(type))  {
                    $u.warn("Type passed to load: ", type);
                    throw "Invalid type value!";
                }

                town[type] = gm.getItem(type + '.records', 'default');
                if (town[type] === 'default' || !$j.isArray(town[type])) {
                    town[type] = gm.setItem(type + '.records', []);
                }

                town[type + "hbest"] = town[type + "hbest"] === false ? JSON.hbest(town[type]) : town[type + "hbest"];
                $u.log(3, "town.load " + type + " Hbest", town[type + "hbest"]);
                state.setItem(type.ucFirst() + "DashUpdate", true);
                $u.log(3, "town.load", type, town[type]);
                return true;
            } catch (err) {
                $u.error("ERROR in town.load: " + err);
                return false;
            }
        },

        save: function (type) {
            try {
                if (!$u.isString(type) || type === '' || !town.types.hasIndexOf(type))  {
                    $u.warn("Type passed to save: ", type);
                    throw "Invalid type value!";
                }

                var compress = false;
                gm.setItem(type + '.records', town[type], town[type + "hbest"], compress);
                state.setItem(type.ucFirst() + "DashUpdate", true);
                $u.log(3, "town.save", type, town[type]);
                return true;
            } catch (err) {
                $u.error("ERROR in town.save: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        GetItems: function (type) {
            try {
                var rowDiv = $j("div[style*='town_unit_bar.jpg'],div[style*='town_unit_bar_owned.jpg']", caap.appBodyDiv),
                    passed = true,
                    save   = false;

                if (!$u.isString(type) || type === '' || !town.types.hasIndexOf(type))  {
                    $u.warn("Type passed to load: ", type);
                    throw "Invalid type value!";
                }

                town[type] = [];
                if ($u.hasContent(rowDiv)) {
                    rowDiv.each(function (index) {
                        var row     = $j(this),
                            current = new town.record(),
                            tempDiv = $j("strong", row).eq(0),
                            tStr    = '',
                            record  = {};

                        if ($u.hasContent(tempDiv) && tempDiv.length === 1) {
                            current.data['name'] = $u.setContent(tempDiv.text(), '').trim().innerTrim();
                            record = spreadsheet.getItem(current.data['name']);
                            current.data['type'] = $u.setContent(record['type'], 'Unknown');
                        } else {
                            $u.warn("Unable to get item name in", type);
                            passed = false;
                        }

                        if (passed) {
                            tempDiv = $j("img", row).eq(0);
                            if ($u.hasContent(tempDiv) && tempDiv.length === 1) {
                                current.data['image'] = $u.setContent(tempDiv.attr("src"), '').basename();
                            } else {
                                $u.log(3, "No image found for", type, current.data['name']);
                            }

                            tempDiv = $j("span[class='negative']", row);
                            if ($u.hasContent(tempDiv) && tempDiv.length === 1) {
                                current.data['upkeep'] = $u.setContent(tempDiv.text(), '0').numberOnly();
                            } else {
                                $u.log(3, "No upkeep found for", type, current.data.name);
                            }

                            tStr = row.children().eq(2).text().trim().innerTrim();
                            if ($u.hasContent(tStr)) {
                                current.data['atk'] = $u.setContent(tStr.regex(/(\d+) Attack/), 0);
                                current.data['def'] = $u.setContent(tStr.regex(/(\d+) Defense/), 0);
                                current.data['api'] = (current.data['atk'] + (current.data['def'] * 0.7)).dp(2);
                                current.data['dpi'] = (current.data['def'] + (current.data['atk'] * 0.7)).dp(2);
                                current.data['mpi'] = ((current.data['api'] + current.data['dpi']) / 2).dp(2);
                            } else {
                                $u.warn("No atk/def found for", type, current.data['name']);
                            }

                            tempDiv = $j("strong[class='gold']", row);
                            if ($u.hasContent(tempDiv) && tempDiv.length === 1) {
                                current.data['cost'] = $u.setContent(tempDiv.text(), '0').numberOnly();
                            } else {
                                $u.log(3, "No cost found for", type, current.data['name']);
                            }

                            tStr = row.children().eq(3).text().trim().innerTrim();
                            if ($u.hasContent(tStr)) {
                                current.data['owned'] = $u.setContent(tStr.regex(/Owned: (\d+)/), 0);
                                current.data['hourly'] = current.data['owned'] * current.data['upkeep'];
                            } else {
                                $u.warn("No number owned found for", type, current.data['name']);
                            }

                            town[type].push(current.data);
                            save = true;
                        }
                    });
                }

                if (save) {
                    town.save(type);
                    $u.log(2, "Got town details for", type);
                } else {
                    $u.log(1, "Nothing to save for", type);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in town.GetItems: " + err);
                return false;
            }
        },

        haveOrb: function (name) {
            try {
                if (!$u.isString(name) || name === '') {
                    throw "Invalid identifying name!";
                }

                var it     = 0,
                    len    = 0,
                    haveIt = false;

                for (it = 0, len = town['magic'].length; it < len; it += 1) {
                    if (town['magic'][it]['name'] === name) {
                        $u.log(3, "town.haveOrb", town['magic'][it]);
                        if (town['magic'][it]['owned']) {
                            haveIt = true;
                        }

                        break;
                    }
                }

                return haveIt;
            } catch (err) {
                $u.error("ERROR in town.haveOrb: " + err);
                return undefined;
            }
        },

        getCount: function (name, image) {
            try {
                var it1     = 0,
                    it2     = 0,
                    tempIt1 = -1,
                    tempIt2 = -1,
                    owned   = 0,
                    found   = false;

                for (it1 = town.types.length - 1; it1 >= 0; it1 -= 1) {
                    if (found) {
                        break;
                    }

                    for (it2 = town[town.types[it1]].length - 1; it2 >= 0; it2 -= 1) {
                        if (town[town.types[it1]][it2]['name'] && town[town.types[it1]][it2]['name'] === name) {
                            tempIt1 = it1;
                            tempIt2 = it2;
                            if (image && town[town.types[it1]][it2]['image'] && town[town.types[it1]][it2]['image'] === image) {
                                found = true;
                                break;
                            }
                        }
                    }
                }

                if (tempIt1 > -1 && tempIt2 > -1) {
                    owned = town[town.types[tempIt1]][tempIt2]['owned'];
                }

                return owned;
            } catch (err) {
                $u.error("ERROR in town.getCount: " + err);
                return undefined;
            }
        },

        report: function () {
            try {
                var it1      = 0,
                    it2      = 0,
                    record   = {},
                    h        = '',
                    missing  = [],
                    w        = $j("#caap_missing_report"),
                    color    = "red",
                    bbcode   = config.getItem("townBBCode", true),
                    sbbcolor = bbcode ? "[color=" + color + "]" : "<td style='color:" + color + "'>",
                    ebbcolor = bbcode ? "[/color]" : "</td>",
                    std      = bbcode ? "" : "<td>",
                    etd      = bbcode ? "" : "</td>";

                if (!$u.hasContent(w)) {
                    for (it1 = town.types.length - 1; it1 >= 0; it1 -= 1) {
                        for (it2 = town[town.types[it1]].length - 1; it2 >= 0; it2 -= 1) {
                            record = spreadsheet.getItem(town[town.types[it1]][it2]['name'], town[town.types[it1]][it2]['image']);
                            if (!$u.hasContent(record) || !$j.isPlainObject(record) || $j.isEmptyObject(record) || town[town.types[it1]][it2]['image'] !== record['image'] || town[town.types[it1]][it2]['atk'] !== record['attack'] || town[town.types[it1]][it2]['def'] !== record['defense']) {
                                h = bbcode ? "[tr][td]" : "<tr>";
                                if (!$u.hasContent(record) || !$j.isPlainObject(record) || $j.isEmptyObject(record)) {
                                    h += sbbcolor + town[town.types[it1]][it2]['name'] + ebbcolor;
                                } else {
                                    h += std + town[town.types[it1]][it2]['name'] + etd;
                                }

                                h += bbcode ? "[/td][td]" : "";
                                if (town[town.types[it1]][it2]['image'] !== record['image']) {
                                    h += sbbcolor + town[town.types[it1]][it2]['image'] + ebbcolor;
                                } else {
                                    h += std + town[town.types[it1]][it2]['image'] + etd;
                                }

                                h += bbcode ? "[/td][td]" : "";
                                if (town[town.types[it1]][it2]['atk'] !== record['attack']) {
                                    h += sbbcolor + town[town.types[it1]][it2]['atk'] + ebbcolor;
                                } else {
                                    h += std + town[town.types[it1]][it2]['atk'] + etd;
                                }

                                h += bbcode ? "[/td][td]" : "";
                                if (town[town.types[it1]][it2]['def'] !== record['defense']) {
                                    h += sbbcolor + town[town.types[it1]][it2]['def'] + ebbcolor;
                                } else {
                                    h += std + town[town.types[it1]][it2]['def'] + etd;
                                }

                                h += bbcode ? "[/td][/tr]" : "</tr>";
                                missing.push(h);
                            }
                        }
                    }

                    if ($u.hasContent(missing)) {
                        missing.sort();
                        if (bbcode) {
                            h = "[table]\n[tr][td][b]Name[/b][/td][td][b]Image[/b][/td][td][b]Attack[/b][/td][td][b]Defense[/b][/td][/tr]\n";
                        } else {
                            h = "<table>\n<tr><th>Name</th><th>Image</th><th>Attack</th><th>Defense</th></tr>\n";
                        }

                        h += missing.join("\n");

                        if (bbcode) {
                            h += "[/table]\n";
                            h = "<textarea style='resize:none;width:600px;height:400px;' readonly='readonly'>" + h + "</textarea>";
                        } else {
                            h += "</table>\n";
                        }

                        w = $j('<div id="caap_missing_report" class="caap_ff caap_fs" title="Missing Item Report">' + h + '</div>').appendTo(document.body);
                        w.dialog({
                            resizable : false,
                            width     : 'auto',
                            height    : bbcode ? 'auto' : '400',
                            buttons   : {
                                "Ok": function () {
                                    w.dialog("destroy").remove();
                                }
                            },
                            close     : function () {
                                w.dialog("destroy").remove();
                            }
                        });
                    } else {
                        $j().alert("Nothing to report.");
                    }
                }

                return true;
            } catch (err) {
                $u.error("ERROR in town.report: " + err);
                return false;
            }
        },

        runReport: function () {
            try {
                var reportType = config.getItem("townReportType", "Units"),
                    stance     = config.getItem("townReportStance", "Attack"),
                    sizeStr    = config.getItem("townReportSize", "Army"),
                    displayRef = reportType + stance + sizeStr;

                return town.bestStuff(reportType, stance, sizeStr, displayRef);
            } catch (err) {
                $u.error("ERROR in town.runReport: " + err);
                return undefined;
            }
        },

        reportType: {
            'Units'   : 'soldiers',
            'Weapons' : 'item',
            'Items'   : 'item',
            'Magic'   : 'magic'
        },

        reportTypeList: function () {
            try {
                var list = [],
                    it   = '';

                for (it in town.reportType) {
                    if (town.reportType.hasOwnProperty(it)) {
                        list.push(it);
                    }
                }

                return list;
            } catch (err) {
                $u.error("ERROR in town.menu: " + err);
                return undefined;
            }
        },

        bestStuffDialog: {},

        bestStuff: function (reportType, stance, size, displayRef) {
            try {
                reportType = $u.setContent(reportType, "Units");
                stance = stance !== "Attack" && stance !== "Defense" ? "Attack" : stance;
                size = $u.isNaN(size) ? caap.stats['army']['capped'] : ($u.isNumber(size) ? size : size.parseInt());
                displayRef = $u.setContent(displayRef, false);
                $u.log(2, "reportType/stance/size/displayRef", reportType, stance, size, displayRef);
                var h    = "<table>\n<tr><th style='white-space: nowrap;'>Name</th><th>Used</th><th>Attack</th><th>Defense</th><th>" + (stance === "attack" ? "API" : "DPI") + "</th></tr>\n",
                    list = $u.owl.deepCopy(town[$u.setContent(town.reportType[reportType], "soldiers")]).sort($u.sortBy(true, stance === "Attack" ? "api" : "dpi", $u.sortBy(false, "cost", $u.sortBy(false, "name", $u.sortBy(true, "owned"))))),
                    best = [],
                    it   = 0,
                    len  = list.length,
                    cnt  = size,
                    buy  = false;

                function destroy(idx) {
                    town.bestStuffDialog[idx].dialog("destroy").remove();
                    delete town.bestStuffDialog[idx];
                }

                for (it = 0; it < len; it += 1) {
                    if (cnt <= 0) {
                        break;
                    }

                    if (list[it]['owned'] === 0 && list[it]['cost'] === 0) {
                        continue;
                    }

                    if (list[it]['type'] === "Weapon") {
                        if (reportType === "Items") {
                            continue;
                        }
                    } else {
                        if (reportType === "Weapons") {
                            continue;
                        }
                    }

                    buy = false;
                    if (list[it]['cost'] !== 0) {
                        buy = true;
                    }

                    if (list[it]['owned'] > cnt) {
                        list[it]['owned'] = cnt;
                    }

                    best.push(list[it]);
                    cnt -= list[it]['owned'];
                    h += "<tr" + (buy ? " style='color: red;'" : "") + "><td style='white-space: nowrap;'>" + list[it]['name'] + "</td><td>" + list[it]['owned'] + "</td><td>" + list[it]['atk'] + "</td><td>" + list[it]['def'] + "</td><td>" + list[it][(stance === "Attack" ? "api" : "dpi")] + "</td></tr>\n";
                }

                h += "</table>\n";
                if (displayRef && !$u.hasContent(town.bestStuffDialog[displayRef])) {
                    town.bestStuffDialog[displayRef] = $j("<div id='caap_best_" + displayRef + "_report' class='caap_ff caap_fs' title='Best " + reportType + " " + stance + " Report: " + size + " Army'>" + h + "</div>").appendTo(document.body);
                    town.bestStuffDialog[displayRef].dialog({
                        resizable : false,
                        width     : '400',
                        height    : '400',
                        buttons   : {
                            Ok: function () {
                                destroy(displayRef);
                            }
                        },
                        close     : function () {
                            destroy(displayRef);
                        }
                    });
                }

                $u.log(2, "town.bestStuff", best);
                return best;
            } catch (err) {
                $u.error("ERROR in town.bestStuff: " + err);
                return undefined;
            }
        },

        menu: function () {
            try {
                var htmlCode = '';

                htmlCode += caap.startToggle('Town', 'TOWN');
                htmlCode += caap.makeDropDownTR("Report Type", 'townReportType', town.reportTypeList(), '', '', 'Units', false, false, 62);
                htmlCode += caap.makeDropDownTR("Stance", 'townReportStance', ["Attack", "Defense"], '', '', 'Attack', false, false, 62);
                htmlCode += caap.makeDropDownTR("Size", 'townReportSize', ['Army', '501', '521', '541'], '', '', 'Army', false, false, 62);
                htmlCode += caap.startTR();
                htmlCode += caap.makeTD("<input type='button' id='caap_TownBestReport' value='Show Report' style='padding: 0; font-size: 10px; height: 18px' />", false, false, "");
                htmlCode += caap.endTR;
                htmlCode += caap.makeCheckTR("Modify Timers", 'townModifyTimers', false, "Advanced timers for how often Town checks are performed.");
                htmlCode += caap.startCheckHide('townModifyTimers');
                htmlCode += caap.makeNumberFormTR("Soldiers Hours", 'checkSoldiers', "Check the Town Soldiers every X hours. Minimum 72.", 72, '', '', true);
                htmlCode += caap.makeNumberFormTR("Items Hours", 'checkItem', "Check the Town Items every X hours. Minimum 72.", 72, '', '', true);
                htmlCode += caap.makeNumberFormTR("Magic Hours", 'checkMagic', "Check the Town Magic every X hours. Minimum 72.", 72, '', '', true);
                htmlCode += caap.endCheckHide('townModifyTimers');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in town.menu: " + err);
                return '';
            }
        },

        dashboard: function () {
            try {
                /*-------------------------------------------------------------------------------------\
                Next we build the HTML to be included into the 'soldiers', 'item' and 'magic' div.
                We set our table and then build the header row.
                \-------------------------------------------------------------------------------------*/
                if ((config.getItem('DBDisplay', '') === 'Soldiers Stats' && state.getItem("SoldiersDashUpdate", true)) || (config.getItem('DBDisplay', '') === 'Item Stats' && state.getItem("ItemDashUpdate", true)) || (config.getItem('DBDisplay', '') === 'Magic Stats' && state.getItem("MagicDashUpdate", true))) {
                    var headers     = ['Name', 'Type', 'Own', 'Atk', 'Def', 'API', 'DPI', 'MPI', 'Cost', 'Upkeep', 'Hourly'],
                        values      = ['name', 'type', 'owned', 'atk', 'def', 'api', 'dpi', 'mpi', 'cost', 'upkeep', 'hourly'],
                        pp          = 0,
                        i           = 0,
                        it          = 0,
                        len         = 0,
                        len1        = 0,
                        len2        = 0,
                        str         = '',
                        num         = 0,
                        header      = {text: '', color: '', bgcolor: '', id: '', title: '', width: ''},
                        head        = '',
                        body        = '',
                        row         = '';

                    for (i = 0, len = town.types.length; i < len; i += 1) {
                        if (config.getItem('DBDisplay', '') !== (town.types[i].ucFirst() + ' Stats')) {
                            continue;
                        }

                        for (pp = 0, len1 = headers.length; pp < len1; pp += 1) {
                            if (town.types[i] !== 'item' && headers[pp] === 'Type') {
                                continue;
                            }

                            header = {
                                text  : headers[pp],
                                color : '',
                                id    : '',
                                title : '',
                                width : ''
                            };

                            switch (headers[pp]) {
                            case 'Name' :
                                header.width = '30%';
                                break;
                            case 'Type' :
                                header.width = '7%';
                                break;
                            case 'Own' :
                                header.width = '6%';
                                break;
                            case 'Atk' :
                                header.width = '6%';
                                break;
                            case 'Def' :
                                header.width = '6%';
                                break;
                            case 'API' :
                                header.width = '6%';
                                break;
                            case 'DPI' :
                                header.width = '6%';
                                break;
                            case 'MPI' :
                                header.width = '6%';
                                break;
                            case 'Cost' :
                                header.width = '9%';
                                break;
                            case 'Upkeep' :
                                header.width = '9%';
                                break;
                            case 'Hourly' :
                                header.width = '9%';
                                break;
                            default:
                            }

                            head += caap.makeTh(header);
                        }

                        head = caap.makeTr(head);
                        for (it = 0, len1 = town[town.types[i]].length; it < len1; it += 1) {
                            row = "";
                            for (pp = 0, len2 = values.length; pp < len2; pp += 1) {
                                if (town.types[i] !== 'item' && values[pp] === 'type') {
                                    continue;
                                }

                                if ($u.isNaN(town[town.types[i]][it][values[pp]]) || !$u.hasContent(town[town.types[i]][it][values[pp]])) {
                                    str = $u.setContent(town[town.types[i]][it][values[pp]], '');
                                } else {
                                    num = town[town.types[i]][it][values[pp]];
                                    str = $u.hasContent(num) && (values[pp] === 'cost' || values[pp] === 'upkeep' || values[pp] === 'hourly') ? "$" + num.SI() : num.addCommas();
                                }

                                row += caap.makeTd({text: str, color: '', id: '', title: ''});
                            }

                            body += caap.makeTr(row);
                        }

                        $j("#caap_" + town.types[i] + "Stats", caap.caapTopObject).html(
                            $j(caap.makeTable(town.types[i], head, body)).dataTable({
                                "bAutoWidth"    : false,
                                "bFilter"       : false,
                                "bJQueryUI"     : false,
                                "bInfo"         : false,
                                "bLengthChange" : false,
                                "bPaginate"     : false,
                                "bProcessing"   : false,
                                "bStateSave"    : true,
                                "bSortClasses"  : false
                            })
                        );

                        state.setItem(town.types[i] + "DashUpdate", false);
                    }
                }

                return true;
            } catch (err) {
                $u.error("ERROR in town.dashboard: " + err);
                return false;
            }
        }
        /*jslint sub: false */
    };

    ////////////////////////////////////////////////////////////////////
    //                          spreadsheet OBJECT
    // this is the main object for dealing with spreadsheet items
    /////////////////////////////////////////////////////////////////////

    spreadsheet = {
        records: [],

        hbest: 2,

        compress: true,

        load: function () {
            try {
                if (!config.getItem("enableTitles", true) && !config.getItem("goblinHinting", true) && !config.getItem("enableRecipeClean", true)) {
                    return true;
                }

                spreadsheet.records = ss.getItem('spreadsheet.records', 'default', true);
                if (spreadsheet.records === 'default' || !$j.isArray(spreadsheet.records) || !spreadsheet.records.length) {
                    spreadsheet.records = [];
                    $j.ajax({
                        url: "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20csv%20where%20url%3D'http%3A%2F%2Fspreadsheets.google.com%2Fpub%3Fkey%3D0At1LY6Vd3Bp9dFFXX2xCc0x3RjJpN1VNbER5dkVvTXc%26hl%3Den%26output%3Dcsv'&format=json",
                        dataType: ($u.is_opera ? "jsonp" : "json"),
                        error:
                            function (XMLHttpRequest, textStatus, errorThrown) {
                                $u.log(1, "Using offline items");
                                spreadsheet.records = offline.items;
                                spreadsheet.save();
                                $u.error("spreadsheet.load", textStatus);
                            },
                        success: function (msg) {
                            try {
                                $u.log(3, "msg", msg);
                                var rows       = [],
                                    row        = 0,
                                    rowsLen    = 0,
                                    column     = 0,
                                    newRecord  = {},
                                    cell       = null,
                                    headers    = {},
                                    headersLen = 0,
                                    headersArr = [],
                                    key        = '';

                                /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
                                /*jslint sub: true */
                                rows = msg['query']['results']['row'];
                                /*jslint sub: false */
                                headers = rows[0];
                                for (key in headers) {
                                    if (headers.hasOwnProperty(key)) {
                                        headersLen = headersArr.push((headers[key]).toLowerCase());
                                    }
                                }

                                for (row = 1, rowsLen = rows.length; row < rowsLen; row += 1) {
                                    newRecord = {};
                                    for (column = 0; column < headersLen; column += 1) {
                                        if (!$u.isDefined(headersArr[column]) || headersArr[column] === '') {
                                            $u.warn("Spreadsheet column is empty", column);
                                            continue;
                                        }

                                        cell = rows[row]["col" + column];
                                        if (!$u.isDefined(cell) || cell === '') {
                                            cell = null;
                                        } else if ($u.isNaN(cell)) {
                                            if (headersArr[column] === "attack" || headersArr[column] === "defense") {
                                                $u.warn("Spreadsheet " + headersArr[column] + " cell is NaN", cell);
                                            }

                                            cell = cell.replace(/"/g, "");
                                        } else {
                                            cell = cell.parseInt();
                                        }

                                        newRecord[headersArr[column]] = cell;
                                    }

                                    spreadsheet.records.push(newRecord);
                                }

                                if (!$u.hasContent(spreadsheet.records)) {
                                    $u.log(1, "Using offline items");
                                    spreadsheet.records = offline.items;
                                }

                                spreadsheet.save();
                            } catch (err) {
                                $u.log(1, "Using offline items");
                                spreadsheet.records = offline.items;
                                spreadsheet.save();
                                $u.error("ERROR in spreadsheet.load: " + err);
                            }
                        }
                    });
                } else {
                    $u.log(3, "spreadsheet.records", spreadsheet.records);
                }

                return true;
            } catch (err) {
                $u.log(1, "Using offline items");
                spreadsheet.records = offline.items;
                spreadsheet.save();
                $u.error("ERROR in spreadsheet.load: " + err);
                return false;
            }
        },

        save: function () {
            try {
                spreadsheet.hbest = spreadsheet.hbest === false ? JSON.hbest(spreadsheet.records) : spreadsheet.hbest;
                $u.log(3, "spreadsheet.records Hbest", spreadsheet.hbest);
                ss.setItem('spreadsheet.records', spreadsheet.records, spreadsheet.hbest, $u.is_firefox ? false : spreadsheet.compress);
                $u.log(3, "spreadsheet.save", spreadsheet.records);
                return true;
            } catch (err) {
                $u.error("ERROR in spreadsheet.save: " + err);
                return false;
            }
        },

        clear: function () {
            try {
                ss.deleteItem('spreadsheet.records');
                spreadsheet.records = [];
                $u.log(3, "spreadsheet.clear", spreadsheet.records);
                return true;
            } catch (err) {
                $u.error("ERROR in spreadsheet.clear: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        getItem: function (name, image) {
            try {
                if (!$u.hasContent(name) || !$u.isString(name)) {
                    $u.warn("name", name);
                    throw "Invalid identifying name!";
                }

                var it     = 0,
                    len    = 0,
                    found  = false,
                    record = {};

                for (it = 0, len = spreadsheet.records.length; it < len; it += 1) {
                    if (image) {
                        if (spreadsheet.records[it]['name'] === name && spreadsheet.records[it]['image'] === image) {
                            record = spreadsheet.records[it];
                            found = true;
                            break;
                        }
                    } else {
                        if (spreadsheet.records[it]['name'] === name) {
                            record = spreadsheet.records[it];
                            found = true;
                            break;
                        }
                    }
                }

                if (!found) {
                    $u.warn("Unable to find spreadsheet record for", name);
                }

                return record;
            } catch (err) {
                $u.error("ERROR in spreadsheet.getItem: " + err);
                return undefined;
            }
        },

        getTitle: function (title, image) {
            try {
                var it       = 0,
                    tempIt   = -1,
                    owned    = 0,
                    titleStr = '',
                    hide     = false,
                    opacity  = false;

                for (it = spreadsheet.records.length - 1; it >= 0; it -= 1) {
                    if (spreadsheet.records[it]['name'] && spreadsheet.records[it]['name'] === title) {
                        tempIt = it;
                        if (spreadsheet.records[it]['image'] && spreadsheet.records[it]['image'] === image) {
                            break;
                        }
                    }
                }

                if (tempIt > -1) {
                    titleStr = spreadsheet.records[tempIt]['name'] + ": " + spreadsheet.records[tempIt]['type'];
                    if ($u.hasContent(spreadsheet.records[tempIt]['attack']) && $u.hasContent(spreadsheet.records[tempIt]['defense'])) {
                        titleStr += ", " + spreadsheet.records[tempIt]['attack'] + "atk," + spreadsheet.records[tempIt]['defense'] + "def";
                    }

                    if ($u.hasContent(spreadsheet.records[tempIt]['hero'])) {
                        titleStr += ", Hero: " + spreadsheet.records[tempIt]['hero'];
                        owned = general.owned(spreadsheet.records[tempIt]['hero']);
                        titleStr += " (Owned: " + owned + ")";
                        hide = (owned ? false : true);
                    }

                    if ($u.hasContent(spreadsheet.records[tempIt]['recipe1'])) {
                        titleStr += ", Recipe1: " + spreadsheet.records[tempIt]['recipe1'];
                        if (spreadsheet.records[tempIt]['recipe1'] === "Map of Atlantis") {
                            owned = caap.stats['other']['atlantis'];
                            titleStr += " (Owned: " + owned + ")";
                            hide = (owned ? false : true);
                        } else {
                            owned = town.getCount(spreadsheet.records[tempIt]['recipe1'], spreadsheet.records[tempIt]['recipe1image']);
                            titleStr += " (Owned: " + owned + ")";
                            hide = (owned ? false : true);
                        }
                    }

                    if ($u.hasContent(spreadsheet.records[tempIt]['recipe2'])) {
                        titleStr += ", Recipe2: " + spreadsheet.records[tempIt]['recipe2'];
                        owned = town.getCount(spreadsheet.records[tempIt]['recipe2'], spreadsheet.records[tempIt]['recipe2image']);
                        titleStr += " (Owned: " + owned + ")";
                        hide = (owned ? false : true);
                    }

                    if ($u.hasContent(spreadsheet.records[tempIt]['recipe3'])) {
                        titleStr += ", Recipe3: " + spreadsheet.records[tempIt]['recipe3'];
                        owned = town.getCount(spreadsheet.records[tempIt]['recipe3'], spreadsheet.records[tempIt]['recipe3image']);
                        titleStr += " (Owned: " + owned + ")";
                        hide = (owned ? false : true);
                    }

                    if ($u.hasContent(spreadsheet.records[tempIt]['recipe4'])) {
                        titleStr += ", Recipe4: " + spreadsheet.records[tempIt]['recipe4'];
                        owned = town.getCount(spreadsheet.records[tempIt]['recipe4'], spreadsheet.records[tempIt]['recipe4image']);
                        titleStr += " (Owned: " + owned + ")";
                        hide = (owned ? false : true);
                    }

                    if ($u.hasContent(spreadsheet.records[tempIt]['recipe5'])) {
                        titleStr += ", Recipe5: " + spreadsheet.records[tempIt]['recipe5'];
                        owned = town.getCount(spreadsheet.records[tempIt]['recipe5'], spreadsheet.records[tempIt]['recipe5image']);
                        titleStr += " (Owned: " + owned + ")";
                        hide = (owned ? false : true);
                    }

                    if ($u.hasContent(spreadsheet.records[tempIt]['summon'])) {
                        titleStr += ", Summon: " + spreadsheet.records[tempIt]['summon'];
                        opacity = true;
                    }

                    if ($u.hasContent(spreadsheet.records[tempIt]['comment'])) {
                        titleStr += ", Comment: " + spreadsheet.records[tempIt]['comment'];
                    }
                }

                return {title: titleStr, opacity: opacity, hide: hide};
            } catch (err) {
                $u.error("ERROR in spreadsheet.getTitle: " + err);
                return undefined;
            }
        },
        /*jslint sub: false */

        doTitles: function (goblin) {
            try {
                var images = $j("#" + caap.domain.id[caap.domain.which] + "globalContainer img");
                if ($u.hasContent(images)) {
                    images.each(function () {
                        var img   = $j(this),
                            div   = $j(),
                            title = '',
                            image = '',
                            style = '',
                            tMes  = {};

                        title = img.attr("title");
                        if ($u.hasContent(title)) {
                            image = $u.setContent(img.attr("src"), '').basename();
                            tMes = spreadsheet.getTitle(title, image);
                            if (tMes && $j.isPlainObject(tMes) && !$j.isEmptyObject(tMes) && tMes.title) {
                                img.attr("title", tMes.title);
                                if (goblin && (tMes.opacity || tMes.hide)) {
                                    div = img.parent().parent();
                                    style = div.attr("style");
                                    style += tMes.opacity ? " opacity: 0.3;" : '';
                                    style += tMes.hide ? " display: none;" : '';
                                    div.attr("style", style);
                                }
                            }
                        }
                    });
                }

                return true;
            } catch (err) {
                $u.error("ERROR in spreadsheet.doTitles: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        isSummon: function (title, image) {
            try {
                var it     = 0,
                    tempIt = -1;

                for (it = spreadsheet.records.length - 1; it >= 0; it -= 1) {
                    if (spreadsheet.records[it]['name'] && spreadsheet.records[it]['name'] === title) {
                        tempIt = it;
                        if (spreadsheet.records[it]['image'] && spreadsheet.records[it]['image'] === image) {
                            break;
                        }
                    }
                }

                return tempIt > -1 && $u.isDefined(spreadsheet.records[tempIt]['summon']) ? true : false;
            } catch (err) {
                $u.error("ERROR in spreadsheet.isSummon: " + err);
                return undefined;
            }
        }
        /*jslint sub: false */
    };

    ////////////////////////////////////////////////////////////////////
    //                          gifting OBJECT
    // this is the main object for dealing with gifting
    /////////////////////////////////////////////////////////////////////

    gifting = {
        extraList: ['Recruiting', 'Sephora', 'Valiant'],

        cachedGiftEntry: {},

        types: ["gifts", "queue", "history"],

        load: function (type) {
            try {
                if (!$u.isString(type) || type === '' || !gifting.types.hasIndexOf(type))  {
                    $u.warn("Type passed to load: ", type);
                    throw "Invalid type value!";
                }

                gifting[type].records = gm.getItem("gifting." + type, 'default');
                if (gifting[type].records === 'default' || !$j.isArray(gifting[type].records)) {
                    gifting[type].records = gm.setItem("gifting." + type, []);
                }

                gifting[type].hbest = gifting[type].hbest === false ? JSON.hbest(gifting[type].records) : gifting[type].hbest;
                $u.log(3, "gifting." + type + " Hbest", gifting[type].hbest);
                $u.log(3, "gifting.load", type, gifting[type].records);
                state.setItem("Gift" + type.ucFirst() + "DashUpdate", true);
                return true;
            } catch (err) {
                $u.error("ERROR in gifting.load: " + err);
                return false;
            }
        },

        save: function (type) {
            try {
                if (!$u.isString(type) || type === '' || !gifting.types.hasIndexOf(type))  {
                    $u.warn("Type passed to load: ", type);
                    throw "Invalid type value!";
                }

                var compress = false;
                gm.setItem("gifting." + type, gifting[type].records, gifting[type].hbest, compress);
                $u.log(3, "gifting.save", type, gifting[type].records);
                state.setItem("Gift" + type.ucFirst() + "DashUpdate", true);
                return true;
            } catch (err) {
                $u.error("ERROR in gifting.save: " + err);
                return false;
            }
        },

        clear: function (type) {
            try {
                if (!$u.isString(type) || type === '' || !gifting.types.hasIndexOf(type))  {
                    $u.warn("Type passed to clear: ", type);
                    throw "Invalid type value!";
                }

                gifting[type].records = gm.setItem("gifting." + type, []);
                gifting.cachedGiftEntry = gm.setItem("GiftEntry", {});
                state.setItem("Gift" + type.ucFirst() + "DashUpdate", true);
                return true;
            } catch (err) {
                $u.error("ERROR in gifting.clear: " + err);
                return false;
            }
        },

        init: function () {
            try {
                var result = true;

                if (!gifting.load("gifts")) {
                    result = false;
                }

                if (!gifting.load("queue")) {
                    result = false;
                }

                if (!gifting.load("history")) {
                    result = false;
                }

                gifting.queue.fix();
                gifting.history.fix();
                return result;
            } catch (err) {
                $u.error("ERROR in gifting.init: " + err);
                return undefined;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        accept: function () {
            try {
                // Some users reported an issue with the following jQuery search using jQuery 1.4.3
                //giftDiv = $j("div[class='messages']:first img:first");
                // So I have changed the query to try and resolve the issue
                var giftDiv   = $j("div[class='messages'] a[href*='profile.php?id='] img", caap.globalContainer).eq(0),
                    tempText  = '',
                    tempNum   = 0,
                    current   = {};

                if ($u.hasContent(giftDiv)) {
                    tempNum = $u.setContent(giftDiv.attr("uid"), '0').parseInt();
                    if ($u.hasContent(tempNum) && tempNum > 0) {
                        current = new gifting.queue.record();
                        current.data['userId'] = tempNum;
                        tempText = $u.setContent(giftDiv.attr("title"), '').trim();
                        if ($u.hasContent(tempText)) {
                            current.data['name'] = tempText;
                        } else {
                            $u.warn("No name found!");
                            current.data['name'] = "Unknown";
                        }
                    } else {
                        $u.warn("No uid found!");
                    }
                } else {
                    $u.warn("No gift messages found!");
                }

                gifting.setCurrent(gm.setItem("GiftEntry", current.data));
                return !$j.isEmptyObject(gifting.getCurrent());
            } catch (err) {
                $u.error("ERROR in gifting.accept: " + err);
                return undefined;
            }
        },
        /*jslint sub: false */

        loadCurrent: function () {
            try {
                gifting.cachedGiftEntry = gm.getItem('GiftEntry', 'default');
                if (gifting.cachedGiftEntry === 'default' || !$j.isPlainObject(gifting.cachedGiftEntry)) {
                    gifting.cachedGiftEntry = gm.setItem('GiftEntry', {});
                }

                return true;
            } catch (err) {
                $u.error("ERROR in gifting.loadCurrent: " + err);
                return false;
            }
        },

        getCurrent: function () {
            try {
                return gifting.cachedGiftEntry;
            } catch (err) {
                $u.error("ERROR in gifting.getCurrent: " + err);
                return undefined;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        setCurrent: function (record) {
            try {
                if (!$u.hasContent(record) || !$j.isPlainObject(record)) {
                    throw "Not passed a record";
                }

                if ($u.isNaN(record['userId']) || record['userId'] < 1) {
                    $u.warn("userId", record, record['userId']);
                    throw "Invalid identifying userId!";
                }

                gifting.cachedGiftEntry = gm.setItem("GiftEntry", record);
                return gifting.cachedGiftEntry;
            } catch (err) {
                $u.error("ERROR in gifting.setCurrent: " + err);
                return undefined;
            }
        },
        /*jslint sub: false */

        clearCurrent: function () {
            try {
                gifting.cachedGiftEntry = gm.setItem("GiftEntry", {});
                state.setItem("GiftingRefresh", 0);
                return gifting.cachedGiftEntry;
            } catch (err) {
                $u.error("ERROR in gifting.clearCurrent: " + err);
                return undefined;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        collecting: function () {
            try {
                var giftEntry = gifting.getCurrent();
                if (!$j.isEmptyObject(giftEntry) && giftEntry['checked']) {
                    gifting.collected(true);
                }

                if ($j.isEmptyObject(giftEntry) && state.getItem('HaveGift', false)) {
                    if (caap.navigateTo('army', 'invite_on.gif')) {
                        return true;
                    }

                    if (!gifting.accept()) {
                        state.setItem('HaveGift', false);
                        return false;
                    }

                    schedule.setItem('ClickedFacebookURL', 30);
                    caap.visitUrl(caap.domain.protocol[caap.domain.ptype] + "apps.facebook.com/reqs.php#confirm_46755028429_0");
                    return true;
                }

                if (!$j.isEmptyObject(giftEntry) && !giftEntry['checked']) {
                    $u.log(1, "Clearing incomplete pending gift", giftEntry);
                    gifting.cachedGiftEntry = gm.setItem("GiftEntry", {});
                }

                return null;
            } catch (err) {
                $u.error("ERROR in gifting.collecting: " + err);
                return undefined;
            }
        },

        collect: function () {
            try {
                var giftEntry  = false,
                    appDiv     = $j(),
                    reload     = false,
                    rfCount    = state.getItem("GiftingRefresh", 0),
                    giftsList  = [];

                if (!window.location.href.hasIndexOf(caap.domain.url[1])) {
                    return false;
                }

                giftEntry = gifting.getCurrent();
                if ($j.isEmptyObject(giftEntry)) {
                    $u.log(1, 'On FB page with but no gift');
                    caap.visitUrl(caap.domain.protocol[caap.domain.ptype] + caap.domain.url[0] + "/index.php?bm=1&ref=bookmarks&count=0");
                    return false;
                }

                if (!giftEntry['checked'] || rfCount > 0) {
                    $u.log(1, 'On FB page with gift ready to go');
                    appDiv = $j("#globalContainer .mbl .uiListItem div[id*='app_46755028429_']");
                    if ($u.hasContent(appDiv)) {
                        giftsList = gifting.gifts.list().concat(gifting.extraList);
                        appDiv.each(function (index) {
                            try {
                                var giftRequest = $j(this),
                                    giftText    = '',
                                    giftType    = '',
                                    userId      = 0,
                                    name        = '',
                                    giftDiv     = $j("span[class='fb_protected_wrapper']", giftRequest),
                                    inputDiv    = $j(".uiButtonConfirm input[name*='gift_accept.php'],input[name*='army.php'],input[name*='quests.php']", giftRequest);

                                if ($u.hasContent(inputDiv)) {
                                    userId = $u.setContent(inputDiv.attr("name"), 'uid=0').regex(/uid=(\d+)/i);
                                    if (giftEntry['userId'] !== userId) {
                                        return true;
                                    }

                                    if ($u.hasContent(giftDiv)) {
                                        giftText = $u.setContent(giftDiv.text(), '').trim();
                                        giftType = giftText.regex(new RegExp("has sent you a (.*) in Castle Age!", "i"));
                                        giftType = $u.setContent(giftType, $u.setContent(giftText.regex(new RegExp(".* army is (recruiting) .* in Castle Age!", "i")), '').ucFirst());
                                        giftType = $u.setContent(giftType, giftText.regex(new RegExp(".* needs your help to persuade the great general (.*) to their side in Castle Age", "i")));
                                        name = giftText.regex(new RegExp("(.*) has sent you a .* in Castle Age!", "i"));
                                        name = $u.setContent(name, giftText.regex(new RegExp("(.*) army is recruiting .* in Castle Age!", "i")));
                                        name = $u.setContent(name, giftText.regex(new RegExp("(.*) needs your help to persuade the great general .* to their side in Castle Age", "i")));
                                        giftEntry['name'] = $u.setContent(giftEntry['name'], $u.setContent(name, 'Unknown'));
                                        if (!$u.hasContent(giftType)) {
                                            $u.warn("No gift type found in ", giftText);
                                        }
                                    } else {
                                        $u.warn("No fb_protected_wrapper in giftRequest", index);
                                    }

                                    if (giftType === '' || !giftsList.hasIndexOf(giftType)) {
                                        $u.log(1, 'Unknown gift type', giftType, giftsList);
                                        giftType = 'Unknown Gift';
                                    } else {
                                        $u.log(1, 'gift type', giftType, giftsList);
                                    }

                                    giftEntry['gift'] = giftType;
                                    giftEntry['found'] = true;
                                    giftEntry['checked'] = true;
                                    gifting.setCurrent(giftEntry);
                                    schedule.setItem('ClickedFacebookURL', 35);
                                    if (!reload) {
                                        rfCount = state.setItem("GiftingRefresh", rfCount + 1);
                                    }

                                    reload = true;
                                    caap.click(inputDiv);
                                    return false;
                                } else {
                                    if (!reload) {
                                        rfCount = state.setItem("GiftingRefresh", rfCount + 1);
                                    }

                                    reload = true;
                                    $u.warn("No input found in giftRequest", index);
                                }

                                return true;
                            } catch (e) {
                                $u.warn("ERROR in gifting.collect: skipping" + e);
                                return true;
                            }
                        });
                    } else {
                        if (!reload) {
                            rfCount = state.setItem("GiftingRefresh", rfCount + 1);
                        }

                        reload = true;
                        $u.warn("No gifts found for CA");
                    }

                    giftEntry['checked'] = true;
                    gifting.setCurrent(giftEntry);
                }

                if (!schedule.check('ClickedFacebookURL')) {
                    return false;
                }

                if (giftEntry['found']) {
                    $u.log(1, 'Gift click timed out');
                } else {
                    giftEntry['gift'] = 'Unknown Gift';
                    gifting.setCurrent(giftEntry);
                    $u.log(1, 'Unable to find gift', giftEntry);
                }

                if (reload && rfCount === 1) {
                    $u.reload();
                }

                state.setItem("GiftingRefresh", 0);
                caap.visitUrl(caap.domain.protocol[caap.domain.ptype] + caap.domain.url[0] + "/gift_accept.php?act=acpt&uid=" + giftEntry['userId']);
                return true;
            } catch (err) {
                $u.error("ERROR in gifting.collect: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        collected: function (force) {
            try {
                var giftEntry   = gifting.getCurrent(),
                    collectOnly = false;

                if (!$j.isEmptyObject(giftEntry)) {
                    if (force || caap.hasImage("gift_yes.gif")) {
                        collectOnly = config.getItem("CollectOnly", false);
                        if (!collectOnly || (collectOnly && config.getItem("CollectAndQueue", false))) {
                            gifting.queue.setItem(giftEntry);
                        }

                        gifting.history.received(giftEntry);
                    }

                    gifting.clearCurrent();
                }

                schedule.setItem("NoGiftDelay", 0);
                return true;
            } catch (err) {
                $u.error("ERROR in gifting.collected: " + err);
                return false;
            }
        },

        popCheck: function (type) {
            try {
                var popDiv     = $j("#pop_content"),
                    tempDiv    = $j(),
                    tempText   = '',
                    tryAgain   = true;

                if ($u.hasContent(popDiv)) {
                    tempDiv = $j("input[name='sendit']", popDiv);
                    if ($u.hasContent(tempDiv)) {
                        $u.log(2, 'Sending gifts to Facebook');
                        caap.click(tempDiv);
                        return true;
                    }

                    tempDiv = $j("input[name='skip_ci_btn']", popDiv);
                    if ($u.hasContent(tempDiv)) {
                        $u.log(2, 'Denying Email Nag For Gift Send');
                        caap.click(tempDiv);
                        return true;
                    }

                    tempDiv = $j("input[name='ok']", popDiv);
                    if ($u.hasContent(tempDiv)) {
                        tempText = $u.setContent(tempDiv.parent().parent().prev().text(), '').trim().innerTrim();
                        if (tempText) {
                            if (/you have run out of requests/.test(tempText)) {
                                $u.log(2, 'Out of gift requests: ', tempText);
                                schedule.setItem("MaxGiftsExceeded", 10800, 300);
                                caap.setDivContent('gifting_mess', "Max gift limit");
                                tryAgain = false;
                            } else {
                                $u.warn('Unknown popup message: ', tempText);
                            }
                        } else {
                            $u.warn('Popup message but no text found');
                        }

                        caap.click(tempDiv);
                        return tryAgain;
                    }

                    tempText = $u.setContent(popDiv.text(), '').trim().innerTrim();
                    if (tempText) {
                        if (/Loading/.test(tempText)) {
                            $u.log(2, "Popup is loading ...");
                            return true;
                        } else {
                            $u.warn('Unknown popup!', tempText);
                            return false;
                        }
                    } else {
                        $u.warn('Popup message but no text found');
                        return false;
                    }
                }

                if (gifting.waitingForDomLoad) {
                    return true;
                }

                return null;
            } catch (err) {
                $u.error("ERROR in gifting.popCheck: " + err);
                return undefined;
            }
        },

        menu: function () {
            try {
                // Other controls
                var giftInstructions = "Automatically receive and send return gifts.",
                    giftQueueUniqueInstructions = "When enabled only unique user's gifts will be queued, otherwise all received gifts will be queued.",
                    giftCollectOnlyInstructions = "Only collect gifts, do not queue and do not return.",
                    giftCollectAndQueueInstructions = "When used with Collect Only it will collect and queue gifts but not return.",
                    giftReturnOnlyOneInstructions = "Only return 1 gift to a person in 24 hours even if you received many from that person.",
                    htmlCode = '';

                htmlCode += caap.startToggle('Gifting', 'GIFTING OPTIONS');
                htmlCode += caap.makeCheckTR('Auto Gifting', 'AutoGift', false, giftInstructions);
                htmlCode += caap.startCheckHide('AutoGift');
                htmlCode += caap.makeCheckTR('Queue unique users only', 'UniqueGiftQueue', true, giftQueueUniqueInstructions);
                htmlCode += caap.makeCheckTR('Collect Only', 'CollectOnly', false, giftCollectOnlyInstructions);
                htmlCode += caap.startCheckHide('CollectOnly');
                htmlCode += caap.makeCheckTR('And Queue', 'CollectAndQueue', false, giftCollectAndQueueInstructions, true);
                htmlCode += caap.endCheckHide('CollectOnly');
                htmlCode += caap.makeDropDownTR("Give", 'GiftChoice', gifting.gifts.list(), '', '', '', false, false, 80);
                htmlCode += caap.makeCheckTR('1 Gift Per Person Per 24hrs', 'ReturnOnlyOne', false, giftReturnOnlyOneInstructions);
                htmlCode += caap.makeCheckTR('Filter Return By UserId', 'FilterReturnId', false, "Do not return gifts to a list of UserIDs");
                htmlCode += caap.startCheckHide('FilterReturnId');
                htmlCode += caap.startTR();
                htmlCode += caap.makeTD(caap.makeTextBox('FilterReturnIdList', "Do not return gifts to these UserIDs. Use ',' between each UserID", '', ''));
                htmlCode += caap.endTR;
                htmlCode += caap.endCheckHide('FilterReturnId');
                htmlCode += caap.makeCheckTR('Filter Return By Gift', 'FilterReturnGift', false, "Do not return gifts for a list of certain gifts recieved");
                htmlCode += caap.startCheckHide('FilterReturnGift');
                htmlCode += caap.startTR();
                htmlCode += caap.makeTD(caap.makeTextBox('FilterReturnGiftList', "Do not return gifts to these received gifts. Use ',' between each gift", '', ''));
                htmlCode += caap.endTR;
                htmlCode += caap.endCheckHide('FilterReturnGift');
                htmlCode += caap.endCheckHide('AutoGift');

                htmlCode += caap.makeCheckTR("Modify Timers", 'giftModifyTimers', false, "Advanced timers for how often Gifting actions are performed.");
                htmlCode += caap.startCheckHide('giftModifyTimers');
                htmlCode += caap.makeNumberFormTR("Max Gift Hours", 'MaxGiftsExceededDelaySecs', "When Max Gifts is exceeded wait X hours before attempting to send gifts. Minimum 1.", 3, '', '', true);
                htmlCode += caap.makeNumberFormTR("One Gift Hours", 'OneGiftPerPersonDelaySecs', "When '1 Gift Per Person Per 24hrs' is enabled this is the timer used and is normally 24. Minimum 1.", 24, '', '', true);
                htmlCode += caap.makeNumberFormTR("Last Tried Delay", 'LastGiftUserDelaySecs', "If we tried to send a gift to a users and they were not in the gifting list then wait X hours before attempting to send a gift to this user again. Minimum 1.", 1, '', '', true);
                htmlCode += caap.makeNumberFormTR("No Gift Delay", 'NoGiftDelaySecs', "When no return gift could be found then wait X minutes before attempting to send gift again. Minimum 30.", 30, '', '', true);
                htmlCode += caap.makeNumberFormTR("Gift List Days", 'checkGift', "Check gift list every X days. Minimum 3.", 3, '', '', true);
                htmlCode += caap.makeNumberFormTR("Ajax Gift Check", 'CheckGiftMins', "Check gifts waiting every X minutes. Minimum 15.", 15, '', '', true);
                htmlCode += caap.endCheckHide('giftModifyTimers');

                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in gifting.menu: " + err);
                return '';
            }
        },

        gifts: {
            options: ['Same Gift As Received', 'Random Gift'],

            hbest: 0,

            records: [],

            /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
            /*jslint sub: true */
            record: function () {
                this.data = {
                    'name'  : '',
                    'image' : ''
                };
            },

            getItem: function (name) {
                try {
                    var it    = 0,
                        len   = 0,
                        gift  = false;

                    if (!$u.isString(name) || name === '') {
                        $u.warn("name", name);
                        throw "Invalid identifying name!";
                    }

                    for (it = 0, len = gifting.gifts.records.length; it < len; it += 1) {
                        if (gifting.gifts.records[it]['name'] === name) {
                            gift = gifting.gifts.records[it];
                            break;
                        }
                    }

                    return gift;
                } catch (err) {
                    $u.error("ERROR in gifting.gifts.getItem: " + err);
                    return undefined;
                }
            },

            getImg: function (name) {
                try {
                    var it    = 0,
                        len   = 0,
                        image = '';

                    if (!$u.isString(name) || name === '') {
                        $u.warn("name", name);
                        throw "Invalid identifying name!";
                    }


                    if (name !== 'Unknown Gift') {
                        for (it = 0, len = gifting.gifts.records.length; it < len; it += 1) {
                            if (gifting.gifts.records[it]['name'] === name) {
                                image = gifting.gifts.records[it]['image'];
                                break;
                            }
                        }

                        if (it >= len) {
                            $u.warn("Gift not in list! ", name);
                        }
                    }

                    return image;
                } catch (err) {
                    $u.error("ERROR in gifting.gifts.getImg: " + err);
                    return undefined;
                }
            },

            populate: function () {
                try {
                    var giftDiv  = $j("#" + caap.domain.id[caap.domain.which] + "giftContainer div[id*='" + caap.domain.id[caap.domain.which] + "gift']", caap.globalContainer),
                        tempText = '',
                        tempArr  = [],
                        update   = false,
                        it       = 0;

                    if ($u.hasContent(giftDiv)) {
                        gifting.clear("gifts");
                        giftDiv.each(function () {
                            var theGift = $j(this),
                                tempDiv = theGift.children().eq(0),
                                newGift = new gifting.gifts.record();

                            if ($u.hasContent(tempDiv)) {
                                tempText = $u.setContent(tempDiv.text(), '').trim().replace("!", "");
                                if ($u.hasContent(tempText)) {
                                    newGift.data['name'] = tempText;
                                } else {
                                    $u.warn("Unable to get gift name! No text in ", tempDiv);
                                    return true;
                                }
                            } else {
                                $u.warn("Unable to get gift name! No child!");
                                return true;
                            }

                            tempDiv = $j("img[class*='imgButton']", theGift);
                            if ($u.hasContent(tempDiv)) {
                                tempText = $u.setContent(tempDiv.attr("src"), '').basename();
                                if (tempText) {
                                    newGift.data['image'] = tempText;
                                } else {
                                    $u.warn("Unable to get gift image! No src in ", tempDiv);
                                    return true;
                                }
                            } else {
                                $u.warn("Unable to get gift image! No img!");
                                return true;
                            }

                            if (gifting.gifts.getItem(newGift.data['name'])) {
                                it = 2;
                                while (gifting.gifts.getItem(newGift.data['name'] + " #" + it)) {
                                    it += 1;
                                }

                                newGift.data['name'] += " #" + it;
                                $u.log(2, "Gift exists, no auto return for ", newGift.data['name']);
                            }

                            gifting.gifts.records.push(newGift.data);
                            update = true;
                            return true;
                        });
                    }

                    if (update) {
                        tempArr = gifting.gifts.list();
                        tempText = config.getItem("GiftChoice", gifting.gifts.options[0]);
                        if (!tempArr.hasIndexOf(tempText))  {
                            $u.log(1, "Gift choice invalid, changing from/to ", tempText, gifting.gifts.options[0]);
                            tempText = config.setItem("GiftChoice", gifting.gifts.options[0]);
                        }

                        caap.changeDropDownList("GiftChoice", tempArr, tempText);
                        gifting.save("gifts");
                    }

                    return update;
                } catch (err) {
                    $u.error("ERROR in gifting.gifts.populate: " + err);
                    return undefined;
                }
            },

            list: function () {
                try {
                    var it       = 0,
                        len      = 0,
                        giftList = [],
                        giftOpts = gifting.gifts.options.slice();

                    for (it = 0, len = gifting.gifts.records.length; it < len; it += 1) {
                        giftList.push(gifting.gifts.records[it]['name']);
                    }

                    return $j.merge(giftOpts, giftList);
                } catch (err) {
                    $u.error("ERROR in gifting.gifts.list: " + err);
                    return undefined;
                }
            },

            random: function () {
                try {
                    return gifting.gifts.records[Math.floor(Math.random() * (gifting.gifts.records.length))]['name'];
                } catch (err) {
                    $u.error("ERROR in gifting.gifts.random: " + err);
                    return undefined;
                }
            },
            /*jslint sub: false */

            length: function () {
                try {
                    return gifting.gifts.records.length;
                } catch (err) {
                    $u.error("ERROR in gifting.gifts.length: " + err);
                    return undefined;
                }
            }
        },

        queue: {
            records: [],

            /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
            /*jslint sub: true */
            record: function () {
                this.data = {
                    'userId'  : 0,
                    'name'    : '',
                    'gift'    : '',
                    'checked' : false,
                    'found'   : false,
                    'chosen'  : false,
                    'sent'    : false,
                    'last'    : 0
                };
            },

            fix: function () {
                try {
                    var it   = 0,
                        save = false;

                    for (it = gifting.queue.records.length - 1; it >= 0; it -= 1) {
                        if ($u.isNaN(gifting.queue.records[it]['userId']) || gifting.queue.records[it]['userId'] < 1 || gifting.queue.records[it]['sent'] === true) {
                            $u.warn("gifting.queue.fix - delete", gifting.queue.records[it]);
                            gifting.queue.records.splice(it, 1);
                            save = true;
                        }
                    }

                    if (save) {
                        gifting.save("queue");
                    }

                    return save;
                } catch (err) {
                    $u.error("ERROR in gifting.queue.fix: " + err);
                    return undefined;
                }
            },

            hbest: 2,

            setItem: function (record) {
                try {
                    if (!$u.hasContent(record) || !$j.isPlainObject(record)) {
                        throw "Not passed a record";
                    }

                    if ($u.isNaN(record['userId']) || record['userId'] < 1) {
                        $u.warn("userId", record['userId']);
                        throw "Invalid identifying userId!";
                    }

                    var it      = 0,
                        len     = 0,
                        found   = false,
                        updated = false;

                    if (config.getItem("UniqueGiftQueue", true)) {
                        for (it = 0, len = gifting.queue.records.length; it < len; it += 1) {
                            if (gifting.queue.records[it]['userId'] === record['userId']) {
                                if (gifting.queue.records[it]['name'] !== record['name']) {
                                    gifting.queue.records[it]['name'] = record['name'];
                                    updated = true;
                                    $u.log(2, "Updated users name", record, gifting.queue.records);
                                }

                                found = true;
                                $u.log(2, "found in queue", gifting.queue.records[it]);
                                break;
                            }
                        }
                    }

                    if (!found) {
                        gifting.queue.records.push(record);
                        updated = true;
                        $u.log(2, "Added gift to queue", record, gifting.queue.records);
                    }

                    if (updated) {
                        gifting.save("queue");
                    }

                    return true;
                } catch (err) {
                    $u.error("ERROR in gifting.queue.setItem: " + err, record);
                    return false;
                }
            },
            /*jslint sub: false */

            deleteIndex: function (index) {
                try {
                    if ($u.isNaN(index) || index < 0 || index >= gifting.queue.records.length) {
                        throw "Invalid index! (" + index + ")";
                    }

                    gifting.queue.records.splice(index, 1);
                    gifting.save("queue");
                    return true;
                } catch (err) {
                    $u.error("ERROR in gifting.queue.deleteIndex: " + err, index);
                    return false;
                }
            },

            length: function () {
                try {
                    return gifting.queue.records.length;
                } catch (err) {
                    $u.error("ERROR in gifting.queue.length: " + err);
                    return undefined;
                }
            },

            randomImg: '',

            /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
            /*jslint sub: true */
            chooseGift: function () {
                try {
                    var it             = 0,
                        it1            = 0,
                        len            = 0,
                        gift           = '',
                        choice         = '',
                        filterId       = false,
                        filterIdList   = [],
                        filterIdLen    = 0,
                        filterGift     = false,
                        filterGiftList = [],
                        filterGiftLen  = 0,
                        filterGiftCont = false,
                        time           = 0;

                    filterId = config.getItem("FilterReturnId", false);
                    if (filterId) {
                        filterIdList = config.getList("FilterReturnIdList", '');
                        filterIdLen = filterIdList.length;
                    }

                    filterGift = config.getItem("FilterReturnGift", false);
                    if (filterGift) {
                        filterGiftList = config.getList("FilterReturnGiftList", '');
                        filterGiftLen = filterGiftList.length;
                    }

                    choice = config.getItem("GiftChoice", gifting.gifts.options[0]);
                    time = config.getItem("LastGiftUserDelaySecs", 1);
                    time = (time < 1 ? 1 : time) * 3600;
                    for (it = 0, len = gifting.queue.records.length; it < len; it += 1) {
                        if (!schedule.since(gifting.queue.records[it]['last'] || 0, time)) {
                            continue;
                        }

                        if (gifting.queue.records[it]['sent']) {
                            continue;
                        }

                        if (filterId && filterIdLen && filterIdList.hasIndexOf(gifting.queue.records[it]['userId'])) {
                            $u.log(2, "chooseGift Filter Id", gifting.queue.records[it]['userId']);
                            continue;
                        }

                        if (filterGift && filterGiftLen) {
                            filterGiftCont = false;
                            for (it1 = 0; it1 < filterGiftLen; it1 += 1) {
                                if (gifting.queue.records[it]['gift'].hasIndexOf(filterGiftList[it1])) {
                                    $u.log(2, "chooseGift Filter Gift", gifting.queue.records[it]['gift']);
                                    filterGiftCont = true;
                                    break;
                                }
                            }

                            if (filterGiftCont) {
                                continue;
                            }
                        }

                        switch (choice) {
                        case gifting.gifts.options[0]:
                            gift = gifting.queue.records[it]['gift'];
                            break;
                        case gifting.gifts.options[1]:
                            gift = $u.setContent(gifting.queue.randomImg, gifting.gifts.random());
                            gifting.queue.randomImg = gift;
                            break;
                        default:
                            gift = choice;
                        }

                        break;
                    }

                    if (!gift) {
                        time = config.getItem("NoGiftDelaySecs", 30);
                        time = (time < 30 ? 30 : time) * 60;
                        schedule.setItem("NoGiftDelay", time, 300);
                    }

                    return gift;
                } catch (err) {
                    $u.error("ERROR in gifting.queue.chooseGift: " + err);
                    return undefined;
                }
            },

            chooseFriend: function (howmany) {
                try {
                    var it             = 0,
                        it1            = 0,
                        len            = 0,
                        tempGift       = '',
                        unselListDiv   = $j("div[class='unselected_list']", caap.appBodyDiv),
                        selListDiv     = $j("div[class='selected_list']", caap.appBodyDiv),
                        unselDiv       = $j(),
                        selDiv         = $j(),
                        first          = true,
                        same           = true,
                        returnOnlyOne  = false,
                        filterId       = false,
                        filterIdList   = [],
                        filterIdLen    = 0,
                        filterGift     = false,
                        filterGiftList = [],
                        filterGiftLen  = 0,
                        filterGiftCont = false,
                        giftingList    = [],
                        searchStr      = '',
                        clickedList    = [],
                        pendingList    = [],
                        chosenList     = [],
                        time           = 0;

                    if ($u.isNaN(howmany) || howmany < 1) {
                        throw "Invalid howmany! (" + howmany + ")";
                    }

                    returnOnlyOne = config.getItem("ReturnOnlyOne", false);
                    filterId = config.getItem("FilterReturnId", false);
                    if (filterId) {
                        filterIdList = config.getList("FilterReturnIdList", '');
                        filterIdLen = filterIdList.length;
                    }

                    filterGift = config.getItem("FilterReturnGift", false);
                    if (filterGift) {
                        filterGiftList = config.getList("FilterReturnGiftList", '');
                        filterGiftLen = filterGiftList.length;
                    }

                    if (config.getItem("GiftChoice", gifting.gifts.options[0]) !== gifting.gifts.options[0]) {
                        same = false;
                    }

                    time = config.getItem("LastGiftUserDelaySecs", 1);
                    time = (time < 1 ? 1 : time) * 3600;
                    for (it = 0, len = gifting.queue.records.length; it < len; it += 1) {
                        gifting.queue.records[it]['chosen'] = false;

                        if (giftingList.length >= howmany) {
                            continue;
                        }

                        if (!schedule.since(gifting.queue.records[it]['last'] || 0, time)) {
                            continue;
                        }

                        if (gifting.queue.records[it]['sent']) {
                            continue;
                        }

                        if (filterId && filterIdLen && filterIdList.hasIndexOf(gifting.queue.records[it]['userId'])) {
                            $u.log(2, "chooseFriend Filter Id", gifting.queue.records[it]['userId']);
                            continue;
                        }

                        if (filterGift && filterGiftLen) {
                            filterGiftCont = false;
                            for (it1 = 0; it1 < filterGiftLen; it1 += 1) {
                                if (gifting.queue.records[it]['gift'].hasIndexOf(filterGiftList[it1])) {
                                    $u.log(2, "chooseFriend Filter Gift", gifting.queue.records[it]['gift']);
                                    filterGiftCont = true;
                                    break;
                                }
                            }

                            if (filterGiftCont) {
                                continue;
                            }
                        }

                        if (returnOnlyOne) {
                            if (gifting.history.checkSentOnce(gifting.queue.records[it]['userId'])) {
                                $u.log(2, "Sent Today: ", gifting.queue.records[it]['userId']);
                                gifting.queue.records[it]['last'] = new Date().getTime();
                                continue;
                            }
                        }

                        if (first) {
                            tempGift = gifting.queue.records[it]['gift'];
                            first = false;
                        }

                        if (gifting.queue.records[it]['gift'] === tempGift || !same) {
                            giftingList.push(gifting.queue.records[it]['userId']);
                        }
                    }

                    if ($u.hasContent(giftingList)) {
                        for (it = 0, len = giftingList.length; it < len; it += 1) {
                            searchStr += "input[value='" + giftingList[it] + "']";
                            if (it >= 0 && it < len - 1) {
                                searchStr += ",";
                            }
                        }

                        unselDiv = $j(searchStr, unselListDiv);
                        if ($u.hasContent(unselDiv)) {
                            unselDiv.each(function () {
                                var unsel = $j(this),
                                    id    = $u.setContent(unsel.attr("value"), '0').parseInt();

                                if (!/none/.test($u.setContent(unsel.parent().attr("style"), ''))) {
                                    caap.waitingForDomLoad = false;
                                    caap.click(unsel);
                                    $u.log(2, "Id clicked:", id);
                                    clickedList.push(id);
                                } else {
                                    $u.log(2, "Id not found, perhaps gift pending:", id);
                                    pendingList.push(id);
                                }
                            });
                        } else {
                            $u.log(2, "Ids not found:", giftingList, searchStr);
                            $j.merge(pendingList, giftingList);
                        }

                        if ($u.hasContent(clickedList)) {
                            for (it = 0, len = clickedList.length; it < len; it += 1) {
                                searchStr += "input[value='" + clickedList[it] + "']";
                                if (it >= 0 && it < len - 1) {
                                    searchStr += ",";
                                }
                            }

                            selDiv = $j(searchStr, selListDiv);
                            if ($u.hasContent(selDiv)) {
                                selDiv.each(function () {
                                    var sel = $j(this),
                                        id  = $u.setContent(sel.attr("value"), '0').parseInt();

                                    if (!/none/.test($u.setContent(sel.parent().attr("style"), ''))) {
                                        $u.log(2, "User Chosen:", id);
                                        chosenList.push(id);
                                    } else {
                                        $u.log(2, "Selected id is none:", id);
                                        pendingList.push(id);
                                    }
                                });
                            } else {
                                $u.log(2, "Selected ids not found:", searchStr);
                                $j.merge(pendingList, clickedList);
                            }
                        }

                        $u.log(2, "chosenList/pendingList", chosenList, pendingList);
                        for (it = 0, len = gifting.queue.records.length; it < len; it += 1) {
                            if (chosenList.hasIndexOf(gifting.queue.records[it]['userId'])) {
                                $u.log(2, "Chosen", gifting.queue.records[it]['userId']);
                                gifting.queue.records[it]['chosen'] = true;
                                gifting.queue.records[it]['last'] = new Date().getTime();
                            } else if (pendingList.hasIndexOf(gifting.queue.records[it]['userId'])) {
                                $u.log(2, "Pending", gifting.queue.records[it]['userId']);
                                gifting.queue.records[it]['last'] = new Date().getTime();
                            }
                        }

                        caap.waitingForDomLoad = false;
                        gifting.save("queue");
                    }

                    return chosenList.length;
                } catch (err) {
                    $u.error("ERROR in gifting.queue.chooseFriend: " + err);
                    return undefined;
                }
            },

            sent: function () {
                try {
                    var it         = 0,
                        resultText = '',
                        sentok     = false,
                        time       = 0;

                    if (window.location.href.hasIndexOf('act=create')) {
                        if ($u.hasContent(caap.resultsWrapperDiv)) {
                            resultText = $u.setContent(caap.resultsWrapperDiv.text(), '').trim().innerTrim();
                            if ($u.hasContent(resultText)) {
                                if (/You have sent \d+ gift/.test(resultText)) {
                                    for (it = gifting.queue.records.length - 1; it >= 0; it -= 1) {
                                        if (gifting.queue.records[it]['chosen']) {
                                            gifting.queue.records[it]['sent'] = true;
                                            gifting.history.sent(gifting.queue.records[it]);
                                            gifting.queue.records.splice(it, 1);
                                        }
                                    }

                                    $u.log(1, 'Confirmed gifts sent out.');
                                    sentok = true;
                                    gifting.save("queue");
                                } else if (/You have exceed the max gift limit for the day/.test(resultText)) {
                                    $u.log(1, 'Exceeded daily gift limit.');
                                    time = config.getItem("MaxGiftsExceededDelaySecs", 3);
                                    time = time < 1 ? 1 : time;
                                    schedule.setItem("MaxGiftsExceeded", time * 3600, 300);
                                    caap.setDivContent('gifting_mess', "Max gift limit");
                                } else {
                                    $u.log(2, 'Result message', resultText);
                                }
                            } else {
                                $u.log(2, 'No result message');
                            }
                        }
                    } else {
                        $u.log(2, 'Not a gift create request');
                    }

                    return sentok;
                } catch (err) {
                    $u.error("ERROR in gifting.queue.sent: " + err);
                    return undefined;
                }
            },

            dashboard: function () {
                try {
                    /*-------------------------------------------------------------------------------------\
                    Next we build the HTML to be included into the 'caap_giftQueue' div. We set our
                    table and then build the header row.
                    \-------------------------------------------------------------------------------------*/
                    if (config.getItem('DBDisplay', '') === 'Gift Queue' && state.getItem("GiftQueueDashUpdate", true)) {
                        var headers                = ['UserId', 'Name', 'Gift', 'FB Cleared', 'Delete'],
                            values                 = ['userId', 'name', 'gift', 'found'],
                            pp                     = 0,
                            i                      = 0,
                            userIdLink             = '',
                            userIdLinkInstructions = '',
                            removeLinkInstructions = '',
                            len                    = 0,
                            len1                   = 0,
                            str                    = '',
                            data                   = {text: '', color: '', bgcolor: '', id: '', title: ''},
                            handler                = null,
                            head                   = '',
                            body                   = '',
                            row                    = '';

                        for (pp = 0, len = headers.length; pp < len; pp += 1) {
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: ''});
                        }

                        head = caap.makeTr(head);
                        for (i = 0, len = gifting.queue.records.length; i < len; i += 1) {
                            row = "";
                            for (pp = 0, len1 = values.length; pp < len1; pp += 1) {
                                str = $u.setContent(gifting.queue.records[i][values[pp]], '');
                                if (/userId/.test(values[pp])) {
                                    userIdLinkInstructions = "Clicking this link will take you to the user keep of " + str;
                                    userIdLink = caap.domain.link + "/keep.php?casuser=" + str;

                                    data = {
                                        text  : '<span id="caap_targetgiftq_' + i + '" title="' + userIdLinkInstructions + '" rlink="' + userIdLink +
                                                '" onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';">' + str + '</span>',
                                        color : 'blue',
                                        id    : '',
                                        title : ''
                                    };

                                    row += caap.makeTd(data);
                                } else {
                                    row += caap.makeTd({text: str, color: '', id: '', title: ''});
                                }
                            }

                            removeLinkInstructions = "Clicking this link will remove " + gifting.queue.records[i]['name'] + "'s entry from the gift queue!";
                            data = {
                                text  : '<span id="caap_removeq_' + i + '" title="' + removeLinkInstructions + '" mname="' +
                                        '" onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';" class="ui-icon ui-icon-circle-close">X</span>',
                                color : 'blue',
                                id    : '',
                                title : ''
                            };

                            row += caap.makeTd(data);
                            body += caap.makeTr(row);
                        }

                        $j("#caap_giftQueue", caap.caapTopObject).html(
                            $j(caap.makeTable("gifting_queue", head, body)).dataTable({
                                "bAutoWidth"    : false,
                                "bFilter"       : false,
                                "bJQueryUI"     : false,
                                "bInfo"         : false,
                                "bLengthChange" : false,
                                "bPaginate"     : false,
                                "bProcessing"   : false,
                                "bStateSave"    : true,
                                "bSortClasses"  : false,
                                "aoColumnDefs"  : [{
                                    "bSortable" : false,
                                    "aTargets"  : [4]
                                }]
                            })
                        );

                        handler = function (e) {
                            var visitUserIdLink = {
                                    rlink     : '',
                                    arlink    : ''
                                },
                                i   = 0,
                                len = 0;

                            for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                                if (e.target.attributes[i].nodeName === 'rlink') {
                                    visitUserIdLink.rlink = e.target.attributes[i].nodeValue;
                                    visitUserIdLink.arlink = visitUserIdLink.rlink.replace(caap.domain.link + "/", "");
                                }
                            }

                            caap.clickAjaxLinkSend(visitUserIdLink.arlink);
                        };

                        $j("span[id*='caap_targetgiftq_']", caap.caapTopObject).unbind('click', handler).click(handler);

                        handler = function (e) {
                            var index = -1,
                                i     = 0,
                                len   = 0,
                                resp  = false;

                            for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                                if (e.target.attributes[i].nodeName === 'id') {
                                    index = e.target.attributes[i].nodeValue.replace("caap_removeq_", "").parseInt();
                                }
                            }

                            resp = confirm("Are you sure you want to remove this queue entry?");
                            if (resp === true) {
                                gifting.queue.deleteIndex(index);
                                caap.updateDashboard(true);
                            }
                        };

                        $j("span[id*='caap_removeq_']", caap.caapTopObject).unbind('click', handler).click(handler);
                        state.setItem("GiftQueueDashUpdate", false);
                    }

                    return true;
                } catch (err) {
                    $u.error("ERROR in gifting.queue.dashboard: " + err);
                    return false;
                }
            }
            /*jslint sub: false */
        },

        history: {
            records: [],

            /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
            /*jslint sub: true */
            record: function () {
                this.data = {
                    'userId'       : 0,
                    'name'         : '',
                    'sent'         : 0,
                    'lastSent'     : 0,
                    'received'     : 0,
                    'lastReceived' : 0
                };
            },

            fix: function () {
                try {
                    var it = 0,
                        save = false;

                    for (it = gifting.history.records.length - 1; it >= 0; it -= 1) {
                        if ($u.isNaN(gifting.history.records[it]['userId']) || gifting.history.records[it]['userId'] < 1) {
                            $u.warn("gifting.history.fix - delete", gifting.history.records[it]);
                            gifting.history.records.splice(it, 1);
                            save = true;
                        }
                    }

                    if (save) {
                        gifting.save("history");
                    }

                    return save;
                } catch (err) {
                    $u.error("ERROR in gifting.history.fix: " + err);
                    return undefined;
                }
            },

            hbest: 0,

            received: function (record) {
                try {
                    if (!$u.hasContent(record) || !$j.isPlainObject(record)) {
                        throw "Not passed a record";
                    }

                    if ($u.isNaN(record['userId']) || record['userId'] < 1) {
                        $u.warn("userId", record['userId']);
                        throw "Invalid identifying userId!";
                    }

                    var it        = 0,
                        len       = 0,
                        success   = false,
                        newRecord = {};

                    for (it = 0, len = gifting.history.records.length; it < len; it += 1) {
                        if (gifting.history.records[it]['userId'] === record['userId']) {
                            if (gifting.history.records[it]['name'] !== record['name']) {
                                gifting.history.records[it]['name'] = record['name'];
                            }

                            gifting.history.records[it]['received'] += 1;
                            gifting.history.records[it]['lastReceived'] = new Date().getTime();
                            success = true;
                            break;
                        }
                    }

                    if (success) {
                        $u.log(2, "Updated gifting.history record", gifting.history.records[it], gifting.history.records);
                    } else {
                        newRecord = new gifting.history.record();
                        newRecord.data['userId'] = record['userId'];
                        newRecord.data['name'] = record['name'];
                        newRecord.data['received'] = 1;
                        newRecord.data['lastReceived'] = new Date().getTime();
                        gifting.history.records.push(newRecord.data);
                        $u.log(2, "Added gifting.history record", newRecord.data, gifting.history.records);
                    }

                    gifting.save("history");
                    return true;
                } catch (err) {
                    $u.error("ERROR in gifting.history.received: " + err, record);
                    return false;
                }
            },

            sent: function (record) {
                try {
                    if (!$u.hasContent(record) || !$j.isPlainObject(record)) {
                        throw "Not passed a record";
                    }

                    if ($u.isNaN(record['userId']) || record['userId'] < 1) {
                        $u.warn("userId", record['userId']);
                        throw "Invalid identifying userId!";
                    }

                    var it        = 0,
                        len       = 0,
                        success   = false,
                        newRecord = {};

                    for (it = 0, len = gifting.history.records.length; it < len; it += 1) {
                        if (gifting.history.records[it]['userId'] === record['userId']) {
                            if (gifting.history.records[it]['name'] !== record['name']) {
                                gifting.history.records[it]['name'] = record['name'];
                            }

                            gifting.history.records[it]['sent'] += 1;
                            gifting.history.records[it]['lastSent'] = new Date().getTime();
                            success = true;
                            break;
                        }
                    }

                    if (success) {
                        $u.log(2, "Updated gifting.history record", gifting.history.records[it], gifting.history.records);
                    } else {
                        newRecord = new gifting.history.record();
                        newRecord.data['userId'] = record['userId'];
                        newRecord.data['name'] = record['name'];
                        newRecord.data['sent'] = 1;
                        newRecord.data['lastSent'] = new Date().getTime();
                        gifting.history.records.push(newRecord.data);
                        $u.log(2, "Added gifting.history record", newRecord.data, gifting.history.records);
                    }

                    gifting.save("history");
                    return true;
                } catch (err) {
                    $u.error("ERROR in gifting.history.sent: " + err, record);
                    return false;
                }
            },

            checkSentOnce: function (userId) {
                try {
                    if ($u.isNaN(userId) || userId < 1) {
                        $u.warn("userId", userId);
                        throw "Invalid identifying userId!";
                    }

                    var it       = 0,
                        len      = 0,
                        sentOnce = false,
                        time     = config.getItem("OneGiftPerPersonDelaySecs", 24);

                    time = (time < 1 ? 1 : time) * 3600;
                    for (it = 0, len = gifting.history.records.length; it < len; it += 1) {
                        if (gifting.history.records[it]['userId'] !== userId) {
                            continue;
                        }

                        sentOnce = !schedule.since(gifting.history.records[it]['lastSent'] || 0, time);
                        break;
                    }

                    return sentOnce;
                } catch (err) {
                    $u.error("ERROR in gifting.history.checkSentOnce: " + err, userId);
                    return undefined;
                }
            },
            /*jslint sub: false */

            length: function () {
                try {
                    return gifting.history.records.length;
                } catch (err) {
                    $u.error("ERROR in gifting.history.length: " + err);
                    return undefined;
                }
            },

            /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
            /*jslint sub: true */
            dashboard: function () {
                try {
                    /*-------------------------------------------------------------------------------------\
                    Next we build the HTML to be included into the 'caap_giftStats' div. We set our
                    table and then build the header row.
                    \-------------------------------------------------------------------------------------*/
                    if (config.getItem('DBDisplay', '') === 'Gifting Stats' && state.getItem("GiftHistoryDashUpdate", true)) {
                        var headers                  = ['UserId', 'Name', 'Received', 'Sent'],
                            values                   = ['userId', 'name', 'received', 'sent'],
                            pp                       = 0,
                            i                        = 0,
                            userIdLink               = '',
                            userIdLinkInstructions   = '',
                            len                      = 0,
                            len1                     = 0,
                            str                      = '',
                            data                     = {text: '', color: '', bgcolor: '', id: '', title: ''},
                            handler                  = null,
                            head                     = '',
                            body                     = '',
                            row                      = '';

                        for (pp = 0, len = headers.length; pp < len; pp += 1) {
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: ''});
                        }

                        head = caap.makeTr(head);
                        for (i = 0, len = gifting.history.records.length; i < len; i += 1) {
                            row = "";
                            for (pp = 0, len1 = values.length; pp < len1; pp += 1) {
                                str = $u.setContent(gifting.history.records[i][values[pp]], '');
                                if (/userId/.test(values[pp])) {
                                    userIdLinkInstructions = "Clicking this link will take you to the user keep of " + str;
                                    userIdLink = caap.domain.link + "/keep.php?casuser=" + str;
                                    data = {
                                        text  : '<span id="caap_targetgift_' + i + '" title="' + userIdLinkInstructions + '" rlink="' + userIdLink +
                                                '" onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';">' + str + '</span>',
                                        color : 'blue',
                                        id    : '',
                                        title : ''
                                    };

                                    row += caap.makeTd(data);
                                } else {
                                    row += caap.makeTd({text: str, color: '', id: '', title: ''});
                                }
                            }

                            body += caap.makeTr(row);
                        }

                        $j("#caap_giftStats", caap.caapTopObject).html(
                            $j(caap.makeTable("gifting_history", head, body)).dataTable({
                                "bAutoWidth"    : false,
                                "bFilter"       : false,
                                "bJQueryUI"     : false,
                                "bInfo"         : false,
                                "bLengthChange" : false,
                                "bPaginate"     : false,
                                "bProcessing"   : false,
                                "bStateSave"    : true,
                                "bSortClasses"  : false
                            })
                        );

                        handler = function (e) {
                            var visitUserIdLink = {
                                    rlink     : '',
                                    arlink    : ''
                                },
                                i   = 0,
                                len = 0;

                            for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                                if (e.target.attributes[i].nodeName === 'rlink') {
                                    visitUserIdLink.rlink = e.target.attributes[i].nodeValue;
                                    visitUserIdLink.arlink = visitUserIdLink.rlink.replace(caap.domain.link + "/", "");
                                }
                            }

                            caap.clickAjaxLinkSend(visitUserIdLink.arlink);
                        };

                        $j("span[id*='caap_targetgift_']", caap.caapTopObject).unbind('click', handler).click(handler);
                        state.setItem("GiftHistoryDashUpdate", false);
                    }

                    return true;
                } catch (err) {
                    $u.error("ERROR in gifting.history.dashboard: " + err);
                    return false;
                }
            }
            /*jslint sub: false */
        }
    };

    /* This section is added to allow Advanced Optimisation by the Closure Compiler */
    /*jslint sub: true */
    window['gifting'] = gifting;
    gifting['gifts'] = gifting.gifts;
    gifting['queue'] = gifting.queue;
    gifting['history'] = gifting.history;
    /*jslint sub: false */

    ////////////////////////////////////////////////////////////////////
    //                          army OBJECT
    // this is the main object for dealing with Army
    /////////////////////////////////////////////////////////////////////

    army = {
        records: [],

        recordsTemp: [],

        perPage: 25,

        pageDone: true,

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        record: function () {
            this.data = {
                'user'   : '',
                'name'   : '',
                'userId' : '',
                'lvl'    : 0,
                'last'   : 0,
                'change' : 0,
                'elite'  : false
            };
        },
        /*jslint sub: false */

        hbest: 3,

        load: function () {
            try {
                army.records = gm.getItem('army.records', 'default');
                if (army.records === 'default' || !$j.isArray(army.records)) {
                    army.records = gm.setItem('army.records', []);
                }

                army.hbest = army.hbest === false ? JSON.hbest(army.records) : army.hbest;
                $u.log(3, "army.load Hbest", army.hbest);
                state.setItem("ArmyDashUpdate", true);
                $u.log(3, "army.load", army.records);
                return true;
            } catch (err) {
                $u.error("ERROR in army.load: " + err);
                return false;
            }
        },

        save: function () {
            try {
                var compress = false;
                gm.setItem('army.records', army.records, army.hbest, compress);
                state.setItem("ArmyDashUpdate", true);
                $u.log(3, "army.save", army.records);
                return true;
            } catch (err) {
                $u.error("ERROR in army.save: " + err);
                return false;
            }
        },

        loadTemp: function () {
            try {
                army.recordsTemp = ss.getItem('army.recordsTemp', 'default', true);
                if (army.recordsTemp === 'default' || !$j.isArray(army.recordsTemp)) {
                    army.recordsTemp = ss.setItem('army.recordsTemp', []);
                }

                $u.log(3, "army.loadTemp", army.recordsTemp);
                return true;
            } catch (err) {
                $u.error("ERROR in army.loadTemp: " + err);
                return false;
            }
        },

        saveTemp: function () {
            try {
                ss.setItem('army.recordsTemp', army.recordsTemp);
                $u.log(3, "army.saveTemp", army.recordsTemp);
                return true;
            } catch (err) {
                $u.error("ERROR in army.saveTemp: " + err);
                return false;
            }
        },

        deleteTemp: function () {
            try {
                ss.deleteItem('army.recordsTemp');
                ss.deleteItem('army.currentPage');
                army.recordsTemp = [];
                $u.log(3, "army.deleteTemp deleted");
                return true;
            } catch (err) {
                $u.error("ERROR in army.saveTemp: " + err);
                return false;
            }
        },

        init: function () {
            army.loadTemp();
            army.load();
            army.eliteFriendCheck();
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        setItem: function (record) {
            try {
                var it    = 0,
                    len   = 0,
                    found = false;

                for (it = 0, len = army.records.length; it < len; it += 1) {
                    if (army.records[it]['userId'] === record['userId']) {
                        found = true;
                        break;
                    }
                }

                if (found) {
                    army.records[it] = record;
                    $u.log(3, "Updated record");
                } else {
                    army.records.push(record);
                    $u.log(3, "Added record");
                }

                army.save();
                return record;
            } catch (err) {
                $u.error("ERROR in army.setItem: " + err);
                return undefined;
            }
        },

        getItem: function (userId) {
            try {
                var it    = 0,
                    len   = 0,
                    found = false;

                for (it = 0, len = army.records.length; it < len; it += 1) {
                    if (army.records[it]['userId'] === userId) {
                        found = true;
                        break;
                    }
                }

                if (!found) {
                    $u.log(3, "Unable to find 'userId'", userId);
                }

                return found ? army.records[it] : {};
            } catch (err) {
                $u.error("ERROR in army.getItem: " + err);
                return undefined;
            }
        },

        deleteItem: function (userId) {
            try {
                var it    = 0,
                    len   = 0,
                    found = false;

                for (it = 0, len = army.records.length; it < len; it += 1) {
                    if (army.records[it]['userId'] === userId) {
                        army.records[it].splice(it, 1);
                        found = true;
                        break;
                    }
                }

                if (!found) {
                    $u.log(3, "Unable to find 'userId'", userId);
                } else {
                    army.save();
                }

                return true;
            } catch (err) {
                $u.error("ERROR in army.setItem: " + err);
                return false;
            }
        },

        page: function () {
            try {
                if (!army.pageDone) {
                    var pages  = $j(),
                        search = $j(),
                        record = {},
                        tStr   = '',
                        tNum   = 0,
                        pCount = 0,
                        it     = 0,
                        len    = 0,
                        number = ss.getItem("army.currentPage", 1, true);

                    if (number === 1) {
                        pages = $j("a[href*='army_member.php?page=']", caap.globalContainer).last();
                        tStr = $u.hasContent(pages) ? pages.attr("href") : '';
                        tNum = $u.hasContent(tStr) ? tStr.regex(/page=(\d+)/) : null;
                        pCount = $u.setContent(tNum, 1);
                        state.setItem("ArmyPageCount", pCount);
                    } else {
                        pCount = state.getItem("ArmyPageCount", 1);
                    }

                    search = $j("a[href*='comments.php?casuser=']", caap.globalContainer);
                    search.each(function () {
                        var el = $j(this);
                        record = new army.record();
                        record.data['userId'] = $u.setContent($u.setContent(el.attr("href"), '').regex(/casuser=(\d+)/), 0);
                        tStr = $u.setContent(el.parents("tr").eq(0).text(), '').trim().innerTrim();
                        record.data['user'] = $u.setContent(tStr.regex(new RegExp('(.+)\\s+"')), '').toString();
                        record.data['name'] = $u.setContent(tStr.regex(new RegExp('"(.+)"')), '').toString();
                        record.data['lvl'] = $u.setContent(tStr.regex(/Level\s+(\d+)/), 0);
                        record.data['last'] = new Date().getTime();
                        if ($u.hasContent(record.data['userId']) && record.data['userId'] > 0) {
                            army.recordsTemp.push(record.data);
                        } else {
                            $u.warn("army.page skipping record", record.data);
                        }
                    });

                    if (number === pCount) {
                        search = $j("a[href*='oracle.php']", $j("img[src*='bonus_member.jpg']", caap.appBodyDiv).parent().parent());
                        if ($u.hasContent(search)) {
                            len = $u.setContent($u.setContent(search.text(), '').regex(/Extra members x(\d+)/), 0);
                            for (it = 1; it <= len; it += 1) {
                                record = new army.record();
                                record.data['userId'] = 0 - it;
                                record.data['name'] = "Extra member " + it;
                                record.data['lvl'] = 0;
                                record.data['last'] = new Date().getTime();
                                army.recordsTemp.push(record.data);
                            }
                        }
                    }

                    ss.setItem("army.currentPage", army.saveTemp() ? number + 1 : number);
                    $u.log(2, "army.page", number, pCount, army.recordsTemp.length);
                    army.pageDone = true;
                }

                return true;
            } catch (err) {
                $u.error("ERROR in army.page: " + err);
                army.pageDone = true;
                caap.waitingForDomLoad = false;
                return false;
            }
        },

        run: function () {
            try {
                var expectedPageCount = 0,
                    currentPage       = 0,
                    scanDays          = $u.setContent(config.getItem("ArmyScanDays", 7), 7);

                currentPage = ss.getItem("army.currentPage", 1, true);
                expectedPageCount = state.getItem("ArmyPageCount", 0);
                if (!expectedPageCount) {
                    expectedPageCount = Math.ceil((caap.stats['army']['actual'] - 1) / army.perPage);
                    expectedPageCount = expectedPageCount ? expectedPageCount : 0;
                }

                if (currentPage > expectedPageCount) {
                    army.pageDone = false;
                    $u.log(3, "army.run", expectedPageCount);
                    if (caap.stats['army']['actual'] - 1 !== army.recordsTemp.length) {
                        $u.log(2, "Army size mismatch. Next schedule set 30 mins.", caap.stats['army']['actual'] - 1, army.recordsTemp.length);
                        schedule.setItem("army_member", 1800, 300);
                    } else {
                        army.merge();
                        schedule.setItem("army_member", scanDays * 86400, 300);
                        $u.log(2, "Army merge complete. Next schedule set " + scanDays + " days.", army.records);
                    }

                    army.deleteTemp();
                    return false;
                } else if (army.pageDone) {
                    army.pageDone = false;
                    caap.clickAjaxLinkSend("army_member.php?page=" + currentPage);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in army.run: " + err);
                return false;
            }
        },

        merge: function () {
            try {
                var it     = 0,
                    len    = 0,
                    record = {};

                for (it = 0, len = army.recordsTemp.length; it < len; it += 1) {
                    record = army.getItem(army.recordsTemp[it]['userId']);
                    if ($u.hasContent(record)) {
                        army.recordsTemp[it]['elite'] = $u.setContent(record['elite'], false);
                        if (army.recordsTemp[it]['lvl'] > record['lvl']) {
                            army.recordsTemp[it]['change'] = army.recordsTemp[it]['last'];
                        } else {
                            if ($u.hasContent(record['change']) && record['change'] > 0) {
                                army.recordsTemp[it]['change'] = record['change'];
                            } else {
                                army.recordsTemp[it]['change'] = army.recordsTemp[it]['last'];
                            }
                        }

                        if (!$u.hasContent(army.recordsTemp[it]['name']) && $u.hasContent(record['name'])) {
                            army.recordsTemp[it]['name'] = record['name'];
                        }

                        if ($u.hasContent(army.recordsTemp[it]['name']) && $u.hasContent(record['name']) && army.recordsTemp[it]['user'] !== record['user']) {
                            army.recordsTemp[it]['name'] = record['name'];
                        }

                        if (!$u.hasContent(army.recordsTemp[it]['user']) && $u.hasContent(record['user'])) {
                            army.recordsTemp[it]['user'] = record['user'];
                        }

                        if ($u.hasContent(army.recordsTemp[it]['user']) && $u.hasContent(record['user']) && army.recordsTemp[it]['user'] !== record['user']) {
                            army.recordsTemp[it]['user'] = record['user'];
                        }

                        if (!$u.hasContent(army.recordsTemp[it]['lvl']) && $u.hasContent(record['lvl'])) {
                            army.recordsTemp[it]['lvl'] = record['lvl'];
                        }

                        if (!$u.hasContent(army.recordsTemp[it]['elite']) && $u.hasContent(record['elite'])) {
                            army.recordsTemp[it]['elite'] = record['elite'];
                        }
                    } else {
                        army.recordsTemp[it]['change'] = army.recordsTemp[it]['last'];
                    }
                }

                army.records = army.recordsTemp.slice();
                army.save();
                return true;
            } catch (err) {
                $u.error("ERROR in army.merge: " + err);
                return false;
            }
        },

        getIdList: function () {
            try {
                var it   = 0,
                    len  = 0,
                    list = [];

                for (it = 0, len = army.records.length; it < len; it += 1) {
                    if ($u.hasContent(army.records[it]['userId']) && army.records[it]['userId'] > 0) {
                        list.push(army.records[it]['userId']);
                    }
                }

                return list;
            } catch (err) {
                $u.error("ERROR in army.getIdList: " + err);
                return undefined;
            }
        },

        getEliteList: function () {
            try {
                var it   = 0,
                    len  = 0,
                    list = [];

                for (it = 0, len = army.records.length; it < len; it += 1) {
                    if ($u.hasContent(army.records[it]['userId']) && army.records[it]['userId'] > 0 && army.records[it]['elite']) {
                        list.push(army.records[it]['userId']);
                    }
                }

                return list;
            } catch (err) {
                $u.error("ERROR in army.getEliteList: " + err);
                return [];
            }
        },
        /*jslint sub: false */

        eliteCheckImg: function () {
            try {
                // Check for Elite Guard Add image
                if (config.getItem("EnableArmy", true) && config.getItem('AutoElite', true) && !config.getItem('AutoEliteIgnore', false) && caap.hasImage('elite_guard_add')) {
                    schedule.setItem('AutoEliteGetList', 0);
                    if (!state.getItem('AutoEliteFew', false)) {
                        state.setItem('AutoEliteEnd', '');
                    }

                    $u.log(1, "Detected spaces in Elite Guard: Scheduling");
                }

                return true;
            } catch (err) {
                $u.error("ERROR in army.eliteCheckImg: " + err);
                return false;
            }
        },

        eliteFull: function () {
            try {
                var eliteList = state.getItem('MyEliteTodo', []);
                schedule.setItem('AutoEliteGetList', 21600, 300);
                state.setItem('AutoEliteEnd', 'Full');
                state.setItem('AutoEliteListFilled', false);
                state.setItem('MyEliteTodo', army.eliteMerge(eliteList));
                return true;
            } catch (err) {
                $u.error("ERROR in army.eliteFull: " + err);
                return false;
            }
        },

        eliteResult: function () {
            try {
                if (/YOUR Elite Guard is FULL/i.test(caap.resultsText)) {
                    army.eliteFull();
                    $u.log(1, "Your Elite Guard is full");
                }

                return true;
            } catch (err) {
                $u.error("ERROR in army.eliteResult: " + err);
                return false;
            }
        },

        eliteMerge: function () {
            try {
                var theList = [];
                if ($u.hasContent(eliteArmyList)) {
                    var eliteArmyList = config.getList('EliteArmyList', '').concat(army.getEliteList());
                    eliteArmyList.concat(army.getIdList().filter(function (x) {
                        return !eliteArmyList.hasIndexOf(x);
                    }));

                    theList = state.setItem('MyEliteTodo', eliteArmyList);
                } else {
                    theList = state.setItem('MyEliteTodo', army.getIdList());
                }

                return theList;
            } catch (err) {
                $u.error("ERROR in army.eliteMerge: " + err);
                return undefined;
            }
        },

        eliteFriendCheck: function () {
            try {
                if (caap.stats['army']['actual'] < 11 || army.getIdList().length < 10) {
                    $u.log(1, 'Not enough friends to fill Elite Guard');
                    state.setItem('AutoEliteFew', true);
                } else {
                    state.setItem('AutoEliteFew', false);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in army.eliteFriendCheck: " + err);
                return false;
            }
        },

        elite: function () {
            try {
                var eliteList = state.getItem('MyEliteTodo', []),
                    user      = 0;

                if (state.getItem('AutoEliteEnd', 'Full') !== 'Full') {
                    state.getItem('AutoEliteEnd', '');
                }

                if (!$j.isArray(eliteList) || !$u.hasContent(eliteList) || (state.getItem('AutoEliteFew', false) && !state.getItem('AutoEliteListFilled', false) && state.getItem('AutoEliteEnd', 'NoArmy') !== 'NoArmy')) {
                    $u.log(1, 'Reset list');
                    eliteList = army.eliteMerge();
                    state.setItem('AutoEliteEnd', '');
                    state.setItem('AutoEliteListFilled', true);
                }

                if (state.getItem('AutoEliteFew', false) && state.getItem('AutoEliteEnd', '') === 'NoArmy') {
                    $u.log(1, "Elite Full");
                    army.eliteFull();
                    return false;
                }

                if ($j.isArray(eliteList) && $u.hasContent(eliteList)) {
                    user = eliteList.shift();
                    $u.log(1, 'Add Elite Guard ID: ', user);
                    state.setItem('MyEliteTodo', eliteList);
                    if (!$u.hasContent(eliteList)) {
                        $u.log(2, 'Army list exhausted');
                        state.setItem('AutoEliteEnd', 'NoArmy');
                    }

                    caap.clickAjaxLinkSend('party.php?twt=jneg&jneg=true&user=' + user);
                    $u.log(1, "Return true");
                    return true;
                }

                $u.log(1, "Return false");
                return false;
            } catch (err) {
                $u.error("ERROR in army.elite: " + err);
                return undefined;
            }
        },

        menu: function () {
            try {
                var armyInstructions            = "Enable or disable the Army functions. Required when using CA's alternative URL.",
                    armyScanInstructions        = "Scan the army pages every X days.",
                    autoEliteInstructions       = "Enable or disable Auto Elite function. If running on web3 url then you must enable Army Functions also.",
                    autoEliteIgnoreInstructions = "Use this option if you have a small army and are unable to fill all 10 Elite positions. This prevents " +
                        "the script from checking for any empty places and will cause Auto Elite to run on its timer only.",
                    htmlCode = '';

                htmlCode += caap.startToggle('Army', 'ARMY OPTIONS');
                htmlCode += caap.makeCheckTR('Enable Army Functions', 'EnableArmy', true, armyInstructions);
                htmlCode += caap.startCheckHide('EnableArmy');
                htmlCode += caap.makeCheckTR('Auto Elite Army', 'AutoElite', false, autoEliteInstructions);
                htmlCode += caap.startCheckHide('AutoElite');
                htmlCode += caap.makeCheckTR('Timed Only', 'AutoEliteIgnore', false, autoEliteIgnoreInstructions);
                htmlCode += caap.startTR();
                htmlCode += caap.makeTD("<input type='button' id='caap_resetElite' value='Do Now' style='padding: 0; font-size: 10px; height: 18px' />");
                htmlCode += caap.endTR;
                htmlCode += caap.startTR();
                htmlCode += caap.makeTD(caap.makeTextBox('EliteArmyList', "Try these UserIDs first. Use ',' between each UserID", '', ''));
                htmlCode += caap.endTR;
                htmlCode += caap.endCheckHide('AutoElite');
                htmlCode += caap.makeNumberFormTR("Scan Every (days)", 'ArmyScanDays', armyScanInstructions, 7, '', '');
                htmlCode += caap.makeCheckTR('Change Indicators', 'ArmyIndicators', false, '');
                htmlCode += caap.startCheckHide('ArmyIndicators');
                htmlCode += caap.makeNumberFormTR("Recent", 'ArmyAgeDaysColor0', '', '#008000', '', 'color', false, false, 50);
                htmlCode += caap.makeNumberFormTR("Warn 1 (days)", 'ArmyAgeDays1', '', 7, '', '');
                htmlCode += caap.makeNumberFormTR("Warn 2", 'ArmyAgeDaysColor1', '', '#ADFF2F', '', 'color', false, false, 50);
                htmlCode += caap.makeNumberFormTR("Warn 2 (days)", 'ArmyAgeDays2', '', 14, '', '');
                htmlCode += caap.makeNumberFormTR("Warn 3", 'ArmyAgeDaysColor2', '', '#FFD700', '', 'color', false, false, 50);
                htmlCode += caap.makeNumberFormTR("Warn 3 (days)", 'ArmyAgeDays3', '', 21, '', '');
                htmlCode += caap.makeNumberFormTR("Warn 4", 'ArmyAgeDaysColor3', '', '#FF8C00', '', 'color', false, false, 50);
                htmlCode += caap.makeNumberFormTR("Warn 4 (days)", 'ArmyAgeDays4', '', 28, '', '');
                htmlCode += caap.makeNumberFormTR("Warn 4", 'ArmyAgeDaysColor4', '', '#FF0000', '', 'color', false, false, 50);
                htmlCode += caap.endCheckHide('ArmyIndicators');
                htmlCode += caap.endCheckHide('EnableArmy');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in army.menu: " + err);
                return '';
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        dashboard: function () {
            try {
                /*-------------------------------------------------------------------------------------\
                Next we build the HTML to be included into the 'caap_army' div. We set our
                table and then build the header row.
                \-------------------------------------------------------------------------------------*/
                if (config.getItem('DBDisplay', '') === 'Army' && state.getItem("ArmyDashUpdate", true)) {
                    var headers                  = ['UserId', 'User', 'Name', 'Level', 'Change', 'Elite', '&nbsp;'],
                        values                   = ['userId', 'user', 'name', 'lvl',   'change'],
                        color                    = '',
                        pp                       = 0,
                        i                        = 0,
                        userIdLink               = '',
                        userIdLinkInstructions   = '',
                        removeLinkInstructions   = '',
                        len                      = 0,
                        len1                     = 0,
                        str                      = '',
                        header                   = {text: '', color: '', bgcolor: '', id: '', title: '', width: ''},
                        data                     = {text: '', color: '', bgcolor: '', id: '', title: ''},
                        handler                  = null,
                        head                     = '',
                        body                     = '',
                        row                      = '';

                    for (pp = 0; pp < headers.length; pp += 1) {
                        header = {
                            text    : headers[pp],
                            color   : '',
                            bgcolor : '',
                            id      : '',
                            title   : '',
                            width   : ''
                        };

                        switch (headers[pp]) {
                        case 'UserId':
                            header.width = '18%';
                            break;
                        case 'User':
                            header.width = '27%';
                            break;
                        case 'Name':
                            header.width = '30%';
                            break;
                        case 'Level':
                            header.width = '7%';
                            break;
                        case 'Change':
                            header.width = '10%';
                            break;
                        case 'Elite':
                            header.width = '7%';
                            break;
                        case '&nbsp;':
                            header.width = '1%';
                            break;
                        default:
                        }

                        head += caap.makeTh(header);
                    }

                    head = caap.makeTr(head);
                    for (i = 0, len = army.records.length; i < len; i += 1) {
                        if (army.records[i]["userId"] <= 0) {
                            continue;
                        }

                        row = "";
                        if (schedule.since(army.records[i]['change'], config.getItem("ArmyAgeDays4", 28) * 86400)) {
                            color = config.getItem("ArmyAgeDaysColor4", 'red');
                        } else if (schedule.since(army.records[i]['change'], config.getItem("ArmyAgeDays3", 21) * 86400)) {
                            color = config.getItem("ArmyAgeDaysColor3", 'darkorange');
                        } else if (schedule.since(army.records[i]['change'], config.getItem("ArmyAgeDays2", 14) * 86400)) {
                            color = config.getItem("ArmyAgeDaysColor2", 'gold');
                        } else if (schedule.since(army.records[i]['change'], config.getItem("ArmyAgeDays1", 7) * 86400)) {
                            color = config.getItem("ArmyAgeDaysColor1", 'greenyellow');
                        } else {
                            color = config.getItem("ArmyAgeDaysColor0", 'green');
                        }

                        for (pp = 0, len1 = values.length; pp < len1; pp += 1) {
                            if (values[pp] === "change") {
                                row += caap.makeTd({
                                    text    : $u.hasContent(army.records[i][values[pp]]) && ($u.isString(army.records[i][values[pp]]) || army.records[i][values[pp]] > 0) ? $u.makeTime(army.records[i][values[pp]], "d-m-Y") : '',
                                    bgcolor : color,
                                    color   : $u.bestTextColor(color),
                                    id      : '',
                                    title   : ''
                                });
                            } else if (values[pp] === "userId") {
                                str = $u.setContent(army.records[i][values[pp]], '');
                                userIdLinkInstructions = "Clicking this link will take you to the user keep of " + str;
                                userIdLink = caap.domain.link + "/keep.php?casuser=" + str;
                                data = {
                                    text  : '<span id="caap_targetarmy_' + i + '" title="' + userIdLinkInstructions + '" rlink="' + userIdLink +
                                            '" onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';">' + str + '</span>',
                                    color : 'blue',
                                    id    : '',
                                    title : ''
                                };

                                row += caap.makeTd(data);
                            } else {
                                row += caap.makeTd({
                                    text  : $u.hasContent(army.records[i][values[pp]]) && ($u.isString(army.records[i][values[pp]]) || army.records[i][values[pp]] > 0) ? army.records[i][values[pp]] : '',
                                    color : '',
                                    id    : '',
                                    title : ''
                                });
                            }
                        }

                        data = {
                            text  : '<input id="caap_elitearmy_' + i + '" type="checkbox" title="Use to fill elite guard first" userid="' + army.records[i]['userId'] + '" cstate="' + (army.records[i]['elite'] ? 'true' : 'false') + '" ' + (army.records[i]['elite'] ? ' checked' : '') + ' />',
                            color : 'blue',
                            id    : '',
                            title : ''
                        };

                        row += caap.makeTd(data);

                        removeLinkInstructions = "Clicking this link will remove " + army.records[i]['user'].escapeHTML() + " from your army!";
                        data = {
                            text  : '<span id="caap_removearmy_' + i + '" title="' + removeLinkInstructions + '" userid="' + army.records[i]['userId'] + '" mname="' + army.records[i]['user'].escapeHTML() +
                                    '" onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';" class="ui-icon ui-icon-circle-close">X</span>',
                            color : 'blue',
                            id    : '',
                            title : ''
                        };

                        row += caap.makeTd(data);
                        body += caap.makeTr(row);
                    }

                    $j("#caap_army", caap.caapTopObject).html(
                        $j(caap.makeTable("army", head, body)).dataTable({
                            "bAutoWidth"    : false,
                            "bFilter"       : false,
                            "bJQueryUI"     : false,
                            "bInfo"         : false,
                            "bLengthChange" : false,
                            "bPaginate"     : false,
                            "bProcessing"   : false,
                            "bStateSave"    : true,
                            "bSortClasses"  : false,
                            "aoColumnDefs"  : [
                                {
                                    "bSortable" : false,
                                    "aTargets"  : [6]
                                },
                                {
                                    "sSortDataType" : "dom-checkbox",
                                    "aTargets"      : [5]
                                },
                                {
                                    "sSortDataType" : "scan-date",
                                    "aTargets"      : [4]
                                }
                            ]
                        })
                    );

                    handler = function (e) {
                        var visitUserIdLink = {
                                rlink     : '',
                                arlink    : ''
                            },
                            i   = 0,
                            len = 0;

                        for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                            if (e.target.attributes[i].nodeName === 'rlink') {
                                visitUserIdLink.rlink = e.target.attributes[i].nodeValue;
                                visitUserIdLink.arlink = visitUserIdLink.rlink.replace(caap.domain.link + "/", "");
                            }
                        }

                        caap.clickAjaxLinkSend(visitUserIdLink.arlink);
                    };

                    $j("span[id*='caap_targetarmy_']", caap.caapTopObject).unbind('click', handler).click(handler);

                    handler = function (e) {
                        var userid = 0,
                            cstate = false,
                            i      = 0,
                            len    = 0,
                            record = {};

                        for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                            if (e.target.attributes[i].nodeName === 'userid') {
                                userid = e.target.attributes[i].nodeValue.parseInt();
                            } else if (e.target.attributes[i].nodeName === 'cstate') {
                                cstate = e.target.attributes[i].nodeValue === 'true' ? true : false;
                            }
                        }

                        if ($u.hasContent(userid) && userid > 0) {
                            record = army.getItem(userid);
                            record['elite'] = !cstate;
                            army.setItem(record);
                            state.setItem("ArmyDashUpdate", true);
                            caap.updateDashboard(true);
                        }
                    };

                    $j("input[id*='caap_elitearmy_']", caap.caapTopObject).unbind('change', handler).change(handler);

                    handler = function (e) {
                        var mname  = '',
                            userid = '',
                            i      = 0,
                            len    = 0,
                            resp   = false;

                        for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                            if (e.target.attributes[i].nodeName === 'userid') {
                                userid = e.target.attributes[i].nodeValue.parseInt();
                            } else if (e.target.attributes[i].nodeName === 'mname') {
                                mname = e.target.attributes[i].nodeValue;
                            }
                        }

                        resp = confirm("Are you sure you want to remove " + mname + " from your army?");
                        if (resp === true) {
                            caap.clickAjaxLinkSend("army_member.php?action=delete&player_id=" + userid);
                            army.deleteItem(userid);
                            state.setItem("ArmyDashUpdate", true);
                            caap.updateDashboard(true);
                        }
                    };

                    $j("span[id*='caap_removearmy_']", caap.caapTopObject).unbind('click', handler).click(handler);

                    state.setItem("ArmyDashUpdate", false);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in army.dashboard: " + err);
                return false;
            }
        }
        /*jslint sub: false */
    };

    ////////////////////////////////////////////////////////////////////
    //                          caap OBJECT
    // this is the main object for the game, containing all methods, globals, etc.
    /////////////////////////////////////////////////////////////////////

    caap = {
        lastReload          : new Date().getTime(),
        pageLoadCounter     : 0,
        flagReload          : false,
        waitingForDomLoad   : false,
        delayMain           : false,
        pageLoadOK          : false,
        caapDivObject       : {},
        caapTopObject       : {},
        caapTopMinObject    : {},
        caapPlayButtonDiv   : {},
        documentTitle       : '',
        newVersionAvailable : typeof CAAP_SCOPE_RUN !== 'undefined' ? (devVersion !== '0' ? (CAAP_SCOPE_RUN[1] > caapVersion || (CAAP_SCOPE_RUN[1] >= caapVersion && CAAP_SCOPE_RUN[2] > devVersion)) : (CAAP_SCOPE_RUN[1] > caapVersion)) : false,
        ajaxLoadIcon        : {},
        globalContainer     : {},
        appBodyDiv          : {},
        tempAjax            : {},
        resultsWrapperDiv   : {},
        resultsText         : '',
        libs                : {
            jQuery     : 'https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js',
            jQueryUI   : 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js',
            farbtastic : 'https://castle-age-auto-player.googlecode.com/files/farbtastic.min.js',
            utility    : 'https://utility-js.googlecode.com/files/utility-0.1.6.min.js',
            dataTables : 'https://castle-age-auto-player.googlecode.com/files/jquery.dataTables-1.7.6.min.js'
        },
        removeLibs   : [],
        domain              : {
            which    : -1,
            protocol : ["http://", "https://"],
            ptype    : 0,
            url      : ["apps.facebook.com/castle_age", "apps.facebook.com/reqs.php#confirm_46755028429_0", "web3.castleagegame.com/castle_ws"],
            id       : ["app46755028429_", "", ""],
            ajax     : ["a46755028429_", "", ""],
            link     : "http://apps.facebook.com/castle_age"
        },

        start: function () {
            var FBID      = 0,
                idOk      = false,
                accountEl = $j(),
                delay     = 1000,
                it        = 0;

            $u.set_log_version(caapVersion + (devVersion !== '0' ? 'd' + devVersion : ''));
            $u.log(1, 'DOM load completed');
            window.clearTimeout(caap_timeout);
            for (it = 0; it < caap.removeLibs.length; it += 1) {
                (document.head || document.getElementsByTagName('head')[0]).removeChild(caap.removeLibs[it]);
            }

            caap.removeLibs = [];
            if (window.location.href.hasIndexOf('apps.facebook.com/castle_age/')) {
                caap.domain.which = 0;
            } else if (window.location.href.hasIndexOf('apps.facebook.com/reqs.php#confirm_46755028429_0')) {
                caap.domain.which = 1;
            } else if (window.location.href.hasIndexOf('web3.castleagegame.com/castle_ws/')) {
                caap.domain.which = 2;
                delay = 5000;
            } else {
                $u.error('Unknown domain!', window.location.href);
                $u.reload();
                return;
            }

            if (window.location.href.hasIndexOf('http://')) {
                caap.domain.ptype = 0;
            } else if (window.location.href.hasIndexOf('https://')) {
                caap.domain.ptype = 1;
            } else {
                $u.error('Unknown protocol!', window.location.href);
                $u.reload();
                return;
            }

            caap.domain.link = caap.domain.protocol[caap.domain.ptype] + caap.domain.url[caap.domain.which];
            $u.log(1, 'Domain', caap.domain.which, caap.domain.protocol[caap.domain.ptype], caap.domain.url[caap.domain.which]);
            caap.documentTitle = document.title;
            caap.jQueryExtend();
            gm = new $u.storage({'namespace': 'caap'});
            ss = new $u.storage({'namespace': 'caap', 'storage_type': 'sessionStorage'});

            function mainCaapLoop() {
                caap.makeActionsList();
                caap.waitMilliSecs = 8000;
                caap.waitMainLoop();
                caap.reloadOccasionally();
            }

            gm.clear('0');
            if (caap.errorCheck()) {
                mainCaapLoop();
                return;
            }

            /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
            /*jslint sub: true */
            if (caap.domain.which >= 0 && caap.domain.which < 2) {
                accountEl = $j('#navAccountName');
                if ($u.hasContent(accountEl)) {
                    FBID = $u.setContent(accountEl.attr('href'), 'id=0').regex(/id=(\d+)/i);
                    if ($u.isNumber(FBID) && FBID > 0) {
                        caap.stats['FBID'] = FBID;
                        idOk = true;
                    }
                }

                if (!idOk) {
                    FBID = $u.setContent($j('script').text(), 'user:0,').regex(new RegExp('[\\s"]*?user[\\s"]*?:(\\d+),', 'i'));
                    if ($u.isNumber(FBID) && FBID > 0) {
                        caap.stats['FBID'] = FBID;
                        idOk = true;
                    }
                }
            } else {
                accountEl = $j("img[src*='graph.facebook.com']");
                FBID = $u.setContent(accountEl.attr("src"), "facebook.com/0/").regex(new RegExp("facebook.com\\/(\\d+)\\/"));
                if ($u.isNumber(FBID) && FBID > 0) {
                    caap.stats['FBID'] = FBID;
                    idOk = true;
                }
            }
            /*jslint sub: false */

            if (!idOk) {
                // Force reload without retrying
                $u.error('No Facebook UserID!!! Reloading ...', FBID, window.location.href);
                window.setTimeout(function () {
                    var newdiv = document.createElement('div');
                    newdiv.innerHTML = "<p>CAAP will retry shortly!</p>";
                    document.body.appendChild(newdiv);
                    window.setTimeout(function () {
                        $u.reload();
                    }, 60000 + (Math.floor(Math.random() * 60) * 1000));
                }, delay);

                return;
            }

            gm.set_storage_id(FBID.toString());
            ss.set_storage_id(FBID.toString());
            config.load();
            $u.set_log_level(config.getItem('DebugLevel', $u.get_log_level()));
            css.addCSS();
            caap.lsUsed();
            schedule.load();
            state.load();
            caap.loadStats(FBID, $u.setContent(accountEl.text(), ''));
            gifting.init();
            gifting.loadCurrent();
            state.setItem('clickUrl', window.location.href);
            schedule.setItem('clickedOnSomething', 0);

            /////////////////////////////////////////////////////////////////////
            // Put code to be run once to upgrade an old version's variables to
            // new format or such here.
            /////////////////////////////////////////////////////////////////////

            if (devVersion !== '0') {
                if (state.getItem('LastVersion', '0') !== caapVersion || state.getItem('LastDevVersion', '0') !== devVersion) {
                    state.setItem('LastVersion', caapVersion);
                    state.setItem('LastDevVersion', devVersion);
                }
            } else {
                if (state.getItem('LastVersion', '0') !== caapVersion) {
                    state.setItem('LastVersion', caapVersion);
                    state.setItem('LastDevVersion', '0');
                }
            }

            if (caap.domain.which === 0 || caap.domain.which === 2) {
                state.setItem('caapPause', 'none');
                state.setItem('ReleaseControl', true);
                window.setTimeout(caap.init, 200);
            }

            mainCaapLoop();
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        lsUsed: function () {
            try {
                var used = {
                        'ffmode' : false,
                        'match'  : 0,
                        'total'  : 0
                    },
                    perc = {
                        caap  : 0,
                        total : 0
                    },
                    msg = '';

                used = gm.used();
                if (!used['ffmode']) {
                    perc.caap = ((used['match'] * 2.048 / 5242880) * 100).dp();
                    $u.log(1, "CAAP localStorage used: " + perc.caap + "%");
                    perc.total = ((used['total'] * 2.048 / 5242880) * 100).dp();
                    if (perc.total >= 90) {
                        $u.warn("Total localStorage used: " + perc.total + "%");
                        msg = "<div style='text-align: center;'>";
                        msg += "<span style='color: red; font-size: 14px; font-weight: bold;'>WARNING!</span><br />";
                        msg += "localStorage usage for domain: " + perc.total + "%<br />";
                        msg += "CAAP is using: " + perc.total + "%";
                        msg += "</div>";
                        window.setTimeout(function () {
                            $j().alert(msg);
                        }, 5000);
                    } else {
                        $u.log(1, "Total localStorage used: " + perc.total + "%");
                    }
                } else {
                    $u.log(1, "CAAP GM storage used (chars): " + used['match']);
                    $u.log(1, "GM storage used (chars): " + used['total']);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in release lsUsed: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        incrementPageLoadCounter: function () {
            try {
                caap.pageLoadCounter += 1;
                $u.log(4, "pageLoadCounter", caap.pageLoadCounter);
                return caap.pageLoadCounter;
            } catch (err) {
                $u.error("ERROR in incrementPageLoadCounter: " + err);
                return undefined;
            }
        },

        /*
        injectCATools: function () {
            $u.injectScript("http://cage.northcornwall.com/hoots/catbox.asp");
        },
        */

        init: function () {
            try {
                caap.ajaxLoadIcon = $j('#' + caap.domain.id[caap.domain.which] + 'AjaxLoadIcon');
                if (caap.domain.which === 0 && config.getItem('backgroundCA', false)) {
                    $j("body").css({
                        'background-image'    : "url('http://image4.castleagegame.com/graphics/guild_webpage_bg.jpg')",
                        'background-position' : 'center top',
                        'background-repeat'   : 'no-repeat',
                        'background-color'    : 'black',
                        'margin'              : '0px'
                    });

                    $j("#contentCol").css({
                        'background-color'    : 'black'
                        //'margin'              : '0px auto 0px'
                    });

                    $j("#contentArea").css({
                        'background-image'    : "url('http://image4.castleagegame.com/graphics/ws_middle.jpg')",
                        'padding'             : '0px 10px'
                    });

                    $j("#leftColContainer,#pagelet_canvas_footer_content,#bottomContent").css({
                        'display'    : 'none'
                    });

                    $j("#contentCol").removeClass("clearfix");
                }

                caap.controlXY.selector = caap.domain.which === 0 ? "#contentArea" : "#globalcss";
                caap.dashboardXY.selector = "#" + caap.domain.id[caap.domain.which] + "app_body_container";
                state.setItem(caap.friendListType.gifta.name + 'Requested', false);
                state.setItem(caap.friendListType.giftc.name + 'Requested', false);
                state.setItem(caap.friendListType.facebook.name + 'Requested', false);
                if (caap.domain.which === 0) {
                    // Get rid of those ads now! :P
                    if (config.getItem('HideAds', false)) {
                        //$j('.UIStandardFrame_SidebarAds').css('display', 'none');
                        $j('#rightCol').css('display', 'none');
                    }

                    if (config.getItem('HideAdsIframe', false)) {
                        $j("iframe[name*='fb_iframe']").eq(0).parent().css('display', 'none');
                        //$j("img[src*='apple_banner_']").parent().parent().css('display', 'none');
                        $j("div[style*='tool_top.jpg']").css('display', 'none');
                    }

                    if (config.getItem('HideFBChat', false)) {
                        window.setTimeout(function () {
                            $j("div[class*='fbDockWrapper fbDockWrapperBottom fbDockWrapperRight']").css('display', 'none');
                        }, 100);
                    }
                }

                // Can create a blank space above the game to host the dashboard if wanted.
                // Dashboard currently uses '185px'
                var shiftDown = gm.getItem('ShiftDown', '', hiddenVar);
                if ($u.hasContent(shiftDown)) {
                    $j(caap.controlXY.selector).css('padding-top', shiftDown);
                }

                general.load();
                monster.load();
                guild_monster.load();
                //arena.load();
                festival.load();
                feed.load();
                battle.load();
                caap.loadDemi();
                caap.loadRecon();
                town.load('soldiers');
                town.load('item');
                town.load('magic');
                army.init();
                spreadsheet.load();
                caap.addControl();
                caap.addDashboard();
                caap.addDashboardMin();
                caap.addPlayButton();
                caap.addCaapAjax();
                caap.addListeners();
                caap.addDBListener();
                caap.checkResults();
                caap.autoStatCheck();
                caap.bestLand = new caap.landRecord().data;
                caap.sellLand = {};
                /*
                if (caap.domain.which === 0 && config.getItem('injectCATools', false)) {
                    caap.injectCATools();
                }
                */

                return true;
            } catch (err) {
                $u.error("ERROR in init: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          NAVIGATION FUNCTIONS
        /////////////////////////////////////////////////////////////////////

        skipArmyPopup: function () {
            try {
                var button = $j("div[style*='army_popup_barbackground.jpg'] img[src*='request_skip2.gif']");
                if ($u.hasContent(button)) {
                    $u.log(1, 'Skipping Army Popup');
                    caap.click(button);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in caap.skipArmyPopup: " + err);
                return false;
            }
        },

        waitTime: 5000,

        visitUrl: function (url, loadWaitTime) {
            try {
                if (!$u.hasContent(url)) {
                    throw 'No url passed to visitUrl';
                }

                caap.waitMilliSecs = $u.setContent(loadWaitTime, caap.waitTime);
                if (!state.getItem('clickUrl', '').hasIndexOf(url)) {
                    state.setItem('clickUrl', url);
                }

                if (caap.waitingForDomLoad === false) {
                    schedule.setItem('clickedOnSomething', 0);
                    caap.waitingForDomLoad = true;
                }

                if (!config.getItem('bookmarkMode', false)) {
                    window.location.href = url;
                }

                return true;
            } catch (err) {
                $u.error("ERROR in caap.visitUrl: " + err);
                return false;
            }
        },

        click: function (obj, loadWaitTime) {
            try {
                if (!$u.hasContent(obj)) {
                    throw 'Null object passed to Click';
                }

                caap.waitMilliSecs = $u.setContent(loadWaitTime, caap.waitTime);
                if (caap.waitingForDomLoad === false) {
                    schedule.setItem('clickedOnSomething', 0);
                    caap.waitingForDomLoad = true;
                }

                var evt = document.createEvent("MouseEvents");
                evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
                /*
                Return Value: boolean
                The return value of dispatchEvent indicates whether any of the listeners
                which handled the event called preventDefault. If preventDefault was called
                the value is false, else the value is true.
                */
                return !(obj.jquery ? obj.get(0) : obj).dispatchEvent(evt);
            } catch (err) {
                $u.error("ERROR in caap.click: " + err);
                return undefined;
            }
        },

        clickAjaxLinkSend: function (link, loadWaitTime) {
            try {
                if (!$u.hasContent(link)) {
                    throw 'No link passed to clickAjaxLinkSend';
                }

                caap.waitMilliSecs = $u.setContent(loadWaitTime, caap.waitTime);
                if (!state.getItem('clickUrl', '').hasIndexOf(link)) {
                    state.setItem('clickUrl', caap.domain.link + '/' + link);
                }

                if (caap.waitingForDomLoad === false) {
                    schedule.setItem('clickedOnSomething', 0);
                    caap.waitingForDomLoad = true;
                }

                var jss = "javascript";
                window.location.href = jss + ":void(" + caap.domain.ajax[caap.domain.which] + "ajaxLinkSend('globalContainer', '" + link + "'))";
                return true;
            } catch (err) {
                $u.error("ERROR in caap.clickAjaxLinkSend: " + err);
                return false;
            }
        },

        clickGetCachedAjax: function (link, loadWaitTime) {
            try {
                if (!$u.hasContent(link)) {
                    throw 'No link passed to clickGetCachedAjax';
                }

                caap.waitMilliSecs = $u.setContent(loadWaitTime, caap.waitTime);
                if (!state.getItem('clickUrl', '').hasIndexOf(link)) {
                    state.setItem('clickUrl', caap.domain.link + '/' + link);
                }

                if (caap.waitingForDomLoad === false) {
                    schedule.setItem('clickedOnSomething', 0);
                    caap.waitingForDomLoad = true;
                }

                var jss = "javascript";
                window.location.href = jss + ":void(" + caap.domain.ajax[caap.domain.which] + "get_cached_ajax('" + link + "', 'get_body'))";
                return true;
            } catch (err) {
                $u.error("ERROR in caap.clickGetCachedAjax: " + err);
                return false;
            }
        },

        ajaxLoad: function (link, selector_dom, selector_load, result, loadWaitTime) {
            try {
                if (!$u.hasContent(link)) {
                    throw 'No link passed to ajaxLoad';
                }

                if (!$u.hasContent(selector_dom)) {
                    throw 'No selector_dom passed to ajaxLoad';
                }

                selector_load = $u.setContent(selector_load, "");
                caap.waitMilliSecs = $u.setContent(loadWaitTime, caap.waitTime);
                if (!state.getItem('clickUrl', '').hasIndexOf($u.setContent(result, link))) {
                    state.setItem('clickUrl', caap.domain.link + '/' + $u.setContent(result, link));
                }

                if (caap.waitingForDomLoad === false) {
                    schedule.setItem('clickedOnSomething', 0);
                    caap.waitingForDomLoad = true;
                }

                caap.ajaxLoadIcon.css("display", "block");
                function onError(XMLHttpRequest, textStatus, errorThrown) {
                    $u.error("caap.ajaxLoad", textStatus);
                }

                function onSuccess(data, textStatus, XMLHttpRequest) {
                    $j(selector_dom).html(selector_load === "" ? caap.tempAjax.html() : $j(selector_load, caap.tempAjax).html());
                    caap.ajaxLoadIcon.css("display", "none");
                    caap.reBind();
                    caap.waitingForDomLoad = false;
                    caap.checkResults();
                }

                caap.ajax(caap.domain.link + '/' + link, onError, onSuccess);
                return true;
            } catch (err) {
                $u.error("ERROR in caap.ajaxLoad: " + err);
                return false;
            }
        },

        navigateTo: function (pathToPage, imageOnPage, webSlice) {
            try {
                webSlice = $u.setContent(webSlice, caap.globalContainer);
                if (!$u.hasContent(webSlice)) {
                    $u.warn('No content to Navigate to', imageOnPage, pathToPage);
                    return false;
                }

                if ($u.hasContent(imageOnPage) && caap.hasImage(imageOnPage, webSlice)) {
                    $u.log(3, 'Image found on page', imageOnPage);
                    return false;
                }

                var pathList = $u.hasContent(pathToPage) ? pathToPage.split(",") : [],
                    s        = 0,
                    jq       = $j(),
                    path     = '';

                for (s = pathList.length - 1; s >= 0; s -= 1) {
                    path = $u.setContent(pathList[s], '');
                    if (!$u.hasContent(path)) {
                        $u.warn('pathList had no content!', pathList[s]);
                        continue;
                    }

                    jq = $j("a[href*='" + path + ".php']", webSlice).not("a[href*='" + path + ".php?']", webSlice);
                    if ($u.hasContent(jq)) {
                        $u.log(2, 'Go to', path);
                    } else {
                        jq = caap.checkForImage(path.hasIndexOf(".") ? path : path + '.', webSlice);
                        if ($u.hasContent(jq)) {
                            $u.log(2, 'Click on image', jq.attr("src").basename());
                        }
                    }

                    if ($u.hasContent(jq)) {
                        caap.click(jq);
                        return true;
                    } else {
                        $u.log(3, 'No anchor or image found', path);
                    }
                }

                $u.warn('Unable to Navigate to', imageOnPage, pathToPage);
                return false;
            } catch (err) {
                $u.error("ERROR in caap.navigateTo: " + err, imageOnPage, pathToPage);
                return undefined;
            }
        },

        checkForImage: function (image, webSlice, subDocument, nodeNum) {
            try {
                webSlice = $u.setContent(webSlice, $u.setContent(subDocument, window.document).body);
                return $j("input[src*='" + image + "'],img[src*='" + image + "'],div[style*='" + image + "']", webSlice).eq($u.setContent(nodeNum, 0));
            } catch (err) {
                $u.error("ERROR in caap.checkForImage: " + err);
                return undefined;
            }
        },

        hasImage: function (image, webSlice, subDocument, nodeNum) {
            try {
                return $u.hasContent(caap.checkForImage(image, webSlice, subDocument, nodeNum));
            } catch (err) {
                $u.error("ERROR in caap.hasImage: " + err);
                return undefined;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          DISPLAY FUNCTIONS
        // these functions set up the control applet and allow it to be changed
        /////////////////////////////////////////////////////////////////////

        chatLink: function (slice, query) {
            try {
                var hr = new RegExp('.*(http:.*)'),
                    qr = /"/g;

                $j(query, slice).each(function () {
                    var e = $j(this),
                        h = '',
                        t = '',
                        a = [];

                    h = e.html();
                    a = $u.hasContent(h) ? h.trim().split("<br>") : [];
                    t = $u.hasContent(a[1]) ? a[1].replace(qr, '').regex(hr) : '';
                    a = $u.hasContent(t) ? t.split(" ") : [];
                    t = $u.hasContent(a) ? h.replace(a[0], "<a href='" + a[0] + "'>" + a[0] + "</a>") : '';
                    if ($u.hasContent(t)) {
                        e.html(t);
                    }
                });

                return true;
            } catch (err) {
                $u.error("ERROR in caap.chatLink: " + err);
                return false;
            }
        },

        makeDropDown: function (idName, dropDownList, instructions, formatParms, defaultValue, css) {
            try {
                var selectedItem = config.getItem(idName, 'defaultValue'),
                    id           = idName ? " id='caap_" + idName + "'" : '',
                    title        = '',
                    htmlCode     = '',
                    item         = 0,
                    len          = 0;

                selectedItem = selectedItem !== 'defaultValue' ? selectedItem : (config.setItem(idName, $u.setContent(defaultValue, dropDownList[0])));
                len = dropDownList.length;
                for (item = 0; item < len; item += 1) {
                    if (selectedItem === dropDownList[item]) {
                        break;
                    }
                }

                title = instructions[item] ? " title='" + instructions[item].toString().escapeHTML() + "'" : '';
                css = css ? " style='" + css + "'" : '';
                formatParms = formatParms ? ' ' + formatParms : '';
                htmlCode = "<select class='caap_ff caap_fs caap_ww'" + id + css + title + formatParms + ">";
                htmlCode += "<option disabled='disabled' value='not selected'>Choose one</option>";
                for (item = 0; item < len; item += 1) {
                    title = instructions[item] ? " title='" + instructions[item].toString().escapeHTML() + "'" : '';
                    htmlCode += "<option value='" + dropDownList[item].toString().escapeHTML() + "'" + (selectedItem === dropDownList[item] ? " selected='selected'" : '') + title + ">" + dropDownList[item].toString().escapeHTML() + "</option>";
                }

                htmlCode += "</select>";
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in makeDropDown: " + err);
                return '';
            }
        },

        startTR: function (id, css) {
            try {
                id = id ? " id='" + id  + "'" : '';
                css = css ? " style='" + css + "'" : '';
                return "<div class='caap_ff caap_fn caap_ww'" + id + css + ">";
            } catch (err) {
                $u.error("ERROR in startTR: " + err);
                return '';
            }
        },

        endTR: "</div>",

        makeTD: function (text, indent, right, css) {
            try {
                css = css ? " style='" + css + "'" : '';
                var cls = " class='caap_ff caap_fn" + (indent ? " caap_in" : '') + (right ? " caap_tr" : '') + "'";
                return "<div" + cls + css + ">" + text + "</div>";
            } catch (err) {
                $u.error("ERROR in makeTD: " + err);
                return '';
            }
        },

        makeSlider: function (text, id, inst, defaultValue, indent) {
            try {
                var value = config.getItem(id, 'defaultValue'),
                    html  = "<div class='caap_ff caap_fn caap_ww' id='caap_" + id + "'>";

                value = value !== 'defaultValue' ? value : config.setItem(id, $u.setContent(defaultValue, 1));
                html += '<div style="width: ' + (indent ? "42%;padding-left: 5%;" : "47%") + ';display: inline-block;">' + text + '</div>';
                html += "<div style='width: 45%;padding-right: 5%;display: inline-block;' id='caap_" + id + "_slider' title='" + inst.escapeHTML() + "'></div>";
                html += "</div>";

                return html;
            } catch (err) {
                $u.error("ERROR in makeTD: " + err);
                return '';
            }
        },

        makeSliderListener: function (id, min, max, step, defaultValue, opacity) {
            try {
                $j("#caap_" + id + "_slider", caap.caapDivObject).slider({
                    orientation : "horizontal",
                    range       : "min",
                    min         : min,
                    max         : max,
                    step        : step,
                    value       : config.getItem(id, defaultValue),
                    slide       : function (event, ui) {
                        if (opacity) {
                            state.setItem(id.replace("Cust", ''), config.setItem(id, ui.value));
                            caap.colorUpdate();
                        } else {
                            config.setItem(id, ui.value);
                        }
                    }
                });

                return true;
            } catch (err) {
                $u.error("ERROR in makeTD: " + err);
                return false;
            }
        },

        makeCheckBox: function (idName, defaultValue, instructions, css) {
            try {
                var id    = idName ? " id='caap_" + idName  + "'" : '',
                    title = instructions ? " title='" + instructions.escapeHTML() + "'" : '',
                    check = config.getItem(idName, 'defaultValue');

                check = check !== 'defaultValue' ? check : config.setItem(idName, $u.setContent(defaultValue, false));
                check = check ? " checked" : '';
                css = css ? " style='" + css + "'" : '';
                return "<input class='caap_ff caap_fn' type='checkbox'" + id + css + title + check + ' />';
            } catch (err) {
                $u.error("ERROR in makeCheckBox: " + err);
                return '';
            }
        },

        makeNumberForm: function (idName, instructions, initDefault, formatParms, subtype, css) {
            try {
                subtype = $u.setContent(subtype, 'number');
                css = $u.setContent(css, '');
                var value = config.getItem(idName, 'defaultValue'),
                    stNum = subtype === 'number',
                    id    = idName ? " id='caap_" + idName + "'" : '',
                    title = instructions ? " title='" + instructions.escapeHTML() + "'" : '',
                    type  = stNum ? " type='text' min='0' step='1'" : " type='text'";

                css += subtype === 'color' ? 'background-color:' + value + '; color:' + $u.bestTextColor(value) + ';' : '';
                css = css ? " style='" + css + "'" : '';
                subtype = subtype ? " data-subtype='" + subtype + "'" : '';
                initDefault = stNum && $u.isNumber(initDefault) ? initDefault : (stNum && $u.hasContent(initDefault) && $u.isString(initDefault) && !$u.isNaN(initDefault) ? initDefault.parseFloat() : (!stNum && $u.isString(initDefault) ? initDefault : ''));
                if (stNum && $u.hasContent(initDefault) && $u.isNaN(initDefault)) {
                    $u.warn("makeNumberForm - default value is not a number!", idName, initDefault);
                }

                value = value !== 'defaultValue' ? value : config.setItem(idName, initDefault);
                formatParms = $u.setContent(formatParms, '');
                return "<input class='caap_ff caap_fs caap_tr caap_ww'" + type + subtype + id + css + formatParms + title + " value='" + value + "' />";
            } catch (err) {
                $u.error("ERROR in makeNumberForm: " + err);
                return '';
            }
        },

        makeCheckTR: function (text, idName, defaultValue, instructions, indent, right, css, id1, css1) {
            try {
                var htmlCode = '';
                htmlCode += caap.startTR(id1 ? idName + id1 : idName + "_row", css1);
                htmlCode += caap.makeTD(text, indent, right, "width: " + (indent ? 85 : 90) + "%; display: inline-block;");
                htmlCode += caap.makeTD(caap.makeCheckBox(idName, defaultValue, instructions, css), false, true, "width: 10%; display: inline-block;");
                htmlCode += caap.endTR;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in makeCheckTR: " + err);
                return '';
            }
        },

        startCheckHide: function (idName, not) {
            try {
                var id  = idName ? " id='caap_" + idName + (not ? "_not" : '') + "_hide'" : '',
                    css = " style='display: " + (config.getItem(idName, false) ? (not ? 'none' : 'block') : (not ? 'block' : 'none')) + ";'";

                return "<div class='caap_ff caap_fn caap_ww'" + id + css + ">";
            } catch (err) {
                $u.error("ERROR in startCheckHide: " + err);
                return '';
            }
        },

        endCheckHide: function () {
            try {
                return "</div>";
            } catch (err) {
                $u.error("ERROR in endCheckHide: " + err);
                return '';
            }
        },

        makeNumberFormTR: function (text, idName, instructions, initDefault, formatParms, subtype, indent, right, width) {
            try {
                indent = $u.setContent(indent, false);
                right = $u.setContent(right, false);
                width = $u.setContent(width, 30);
                var htmlCode = '';
                htmlCode += caap.startTR();
                htmlCode += caap.makeTD(text, indent, right, "width: " + (indent ? 92 - width : 97 - width) + "%; display: inline-block;");
                htmlCode += caap.makeTD(caap.makeNumberForm(idName, instructions, initDefault, formatParms, subtype, ''), false, true, "width: " + width + "%; display: inline-block;");
                htmlCode += caap.endTR;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in makeNumberFormTR: " + err);
                return '';
            }
        },

        makeDropDownTR: function (text, idName, dropDownList, instructions, formatParms, defaultValue, indent, right, width, css, id1, css1) {
            try {
                var htmlCode = '';
                htmlCode += caap.startTR(id1 ? idName + id1 : idName + "_row", css1);
                htmlCode += caap.makeTD(text, indent, right, "width: " + (indent ? 95 - width : 100 - width) + "%; display: inline-block;");
                htmlCode += caap.makeTD(caap.makeDropDown(idName, dropDownList, instructions, formatParms, defaultValue, css), false, true, "width: " + width + "%; display: inline-block;");
                htmlCode += caap.endTR;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in makeDropDownTR: " + err);
                return '';
            }
        },

        startDropHide: function (idName, idPlus, test, not) {
            try {
                var value  = config.getItem(idName, 'Never'),
                    result = not ? value !== test : value === test,
                    id     = " id='caap_" + idName + idPlus + "_hide'",
                    css    = " style='display: " + (result ? 'block' : 'none') + ";'";

                return "<div class='caap_ff caap_fn caap_ww'" + id + css + ">";
            } catch (err) {
                $u.error("ERROR in startDropHide: " + err);
                return '';
            }
        },

        endDropHide: function () {
            try {
                return "</div>";
            } catch (err) {
                $u.error("ERROR in endDropHide: " + err);
                return '';
            }
        },

        startToggle: function (controlId, staticText) {
            try {
                var currentDisplay = state.getItem('Control_' + controlId, "none"),
                    displayChar    = currentDisplay === "none" ? "+" : "-",
                    style = "font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;",
                    toggleCode     = '';

                toggleCode += '<a style=\"font-weight: bold;' + style + '\" id="caap_Switch_' + controlId + '" href="javascript:;" style="text-decoration: none;"> ';
                toggleCode += displayChar + ' ' + staticText + '</a><br />' + "<div id='caap_" + controlId + "' style='display: " + currentDisplay + ";'>";
                return toggleCode;
            } catch (err) {
                $u.error("ERROR in startToggle: " + err);
                return '';
            }
        },

        endToggle: "<hr /></div>",

        makeTextBox: function (idName, instructions, initDefault) {
            try {
                initDefault = $u.setContent(initDefault, '');
                var style = "font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;",
                    value = config.getItem(idName, 'defaultValue');

                value = value === 'defaultValue' ? config.setItem(idName, initDefault) : value;
                return "<textarea style=\"" + style + "\" title=" + '"' + instructions.escapeHTML() + '"' + " type='text' id='caap_" + idName + "' " + ($u.is_chrome ? " rows='3' cols='25'" : " rows='3' cols='21'") + ">" + value + "</textarea>";
            } catch (err) {
                $u.error("ERROR in makeTextBox: " + err);
                return '';
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        setDivContent: function (idName, mess) {
            try {
                if (config.getItem('SetTitle', false) && idName === "activity_mess") {
                    var DocumentTitle = config.getItem('SetTitleAction', false) ? mess.replace("Activity: ", '') + " - " : '';
                    DocumentTitle += config.getItem('SetTitleName', false) ? caap.stats['PlayerName'] + " - " : '';
                    document.title = DocumentTitle + caap.documentTitle;
                }

                $j('#caap_' + idName, caap.caapDivObject).html(mess);
            } catch (err) {
                $u.error("ERROR in setDivContent: " + err);
            }
        },
        /*jslint sub: false */

        landQuestList: [
            'Land of Fire',
            'Land of Earth',
            'Land of Mist',
            'Land of Water',
            'Demon Realm',
            'Undead Realm',
            'Underworld',
            'Kingdom of Heaven',
            'Ivory City',
            'Earth II',
            'Water II',
            'Mist II',
            'Mist III'
        ],

        demiQuestList: [
            'Ambrosia',
            'Malekus',
            'Corvintheus',
            'Aurora',
            'Azeron'
        ],

        atlantisQuestList: [
            'Atlantis'
        ],

        selectDropOption: function (idName, value) {
            try {
                var drop = $j("#caap_" + idName, caap.caapDivObject);
                $j("option", drop).removeAttr('selected');
                drop.val(value);
                return true;
            } catch (err) {
                $u.error("ERROR in selectDropOption: " + err);
                return false;
            }
        },

        autoQuest: function () {
            this.data = {
                'name'     : '',
                'energy'   : 0,
                'general'  : 'none',
                'expRatio' : 0
            };
        },

        newAutoQuest: function () {
            return new caap.autoQuest().data;
        },

        updateAutoQuest: function (id, value) {
            try {
                if (!$u.isString(id) || !$u.hasContent(id)) {
                    throw "No valid id supplied!";
                }

                if (!$u.hasContent(value)) {
                    throw "No value supplied!";
                }

                var temp = state.getItem('AutoQuest', caap.newAutoQuest());
                temp[id] = value;
                state.setItem('AutoQuest', temp);
                return true;
            } catch (err) {
                $u.error("ERROR in updateAutoQuest: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        showAutoQuest: function () {
            try {
                $j("#stopAutoQuest", caap.caapDivObject).text("Stop auto quest: " + state.getItem('AutoQuest', caap.newAutoQuest())['name'] + " (energy: " + state.getItem('AutoQuest', caap.newAutoQuest())['energy'] + ")").css('display', 'block');
                return true;
            } catch (err) {
                $u.error("ERROR in showAutoQuest: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        clearAutoQuest: function () {
            try {
                $j("#stopAutoQuest", caap.caapDivObject).text("").css('display', 'none');
                return true;
            } catch (err) {
                $u.error("ERROR in clearAutoQuest: " + err);
                return false;
            }
        },

        manualAutoQuest: function (AutoQuest) {
            try {
                state.setItem('AutoQuest', $u.setContent(AutoQuest, caap.newAutoQuest()));
                caap.selectDropOption('WhyQuest', config.setItem('WhyQuest', 'Manual'));
                caap.clearAutoQuest();
                return true;
            } catch (err) {
                $u.error("ERROR in manualAutoQuest: " + err);
                return false;
            }
        },

        changeDropDownList: function (idName, dropList, option) {
            try {
                $j("#caap_" + idName + " option", caap.caapDivObject).remove();
                $j("#caap_" + idName, caap.caapDivObject).append("<option disabled='disabled' value='not selected'>Choose one</option>");
                var item = 0,
                    len  = dropList.length,
                    drop = $j("#caap_" + idName, caap.caapDivObject);

                for (item = 0; item < len; item += 1) {
                    if (item === 0 && !option) {
                        config.setItem(idName, dropList[item]);
                        $u.log(1, "Saved: " + idName + "  Value: " + dropList[item]);
                    }

                    $j("#caap_" + idName, caap.caapDivObject).append("<option value='" + dropList[item].escapeHTML() + "'>" + dropList[item].escapeHTML() + "</option>");
                }

                if (option) {
                    drop.val(option.escapeHTML());
                } else {
                    drop.val($j("option:eq(1)", drop).val());
                }

                return true;
            } catch (err) {
                $u.error("ERROR in changeDropDownList: " + err);
                return false;
            }
        },

        controlXY: {
            selector : '',
            x        : 0,
            y        : 0
        },

        getControlXY: function (reset, tools) {
            try {
                var selector  = $j(caap.controlXY.selector),
                        outer = selector.outerWidth(true),
                        xoff  = !tools && (caap.domain.which === 2 || (caap.domain.which === 0 && !config.getItem('backgroundCA', false))) ? outer + 10 : outer;

                return {
                    y: reset ? selector.offset().top : caap.controlXY.y,
                    x: caap.controlXY.x === '' || reset ? selector.offset().left + xoff : selector.offset().left + caap.controlXY.x
                };
            } catch (err) {
                $u.error("ERROR in getControlXY: " + err);
                return {x: 0, y: 0};
            }
        },

        saveControlXY: function () {
            try {
                state.setItem('caap_div_menuTop', caap.caapDivObject.offset().top);
                state.setItem('caap_div_menuLeft', caap.caapDivObject.offset().left - $j(caap.controlXY.selector).offset().left);
                state.setItem('caap_top_zIndex', '1');
                state.setItem('caap_div_zIndex', '2');
            } catch (err) {
                $u.error("ERROR in saveControlXY: " + err);
            }
        },

        dashboardXY: {
            selector : '',
            x        : 0,
            y        : 0
        },

        getDashboardXY: function (reset) {
            try {
                var selector = $j(caap.dashboardXY.selector);

                return {
                    y: reset ? selector.offset().top - 10 : caap.dashboardXY.y,
                    x: caap.dashboardXY.x === '' || reset ? selector.offset().left : selector.offset().left + caap.dashboardXY.x
                };
            } catch (err) {
                $u.error("ERROR in getDashboardXY: " + err);
                return {x: 0, y: 0};
            }
        },

        saveDashboardXY: function () {
            try {
                state.setItem('caap_top_menuTop', caap.caapTopObject.offset().top);
                state.setItem('caap_top_menuLeft', caap.caapTopObject.offset().left - $j(caap.dashboardXY.selector).offset().left);
                state.setItem('caap_div_zIndex', '1');
                state.setItem('caap_top_zIndex', '2');
                caap.dashboardXY.x = state.getItem('caap_top_menuLeft', '');
                caap.dashboardXY.y = state.getItem('caap_top_menuTop', $j(caap.dashboardXY.selector).offset().top - 10);
            } catch (err) {
                $u.error("ERROR in saveDashboardXY: " + err);
            }
        },

        addControl: function () {
            try {
                var caapDiv  = "<div id='caap_div'>",
                    divID    = 0,
                    len      = 0,
                    styleXY  = {
                        x: 0,
                        y: 0
                    },
                    bgc = state.getItem('StyleBackgroundLight', '#E0C691'),
                    htmlCode = '',
                    banner   = '',
                    donate   = '',
                    divList  = [
                        'banner',
                        'activity_mess',
                        'idle_mess',
                        'quest_mess',
                        'battle_mess',
                        'monster_mess',
                        'guild_monster_mess',
                        //'arena_mess',
                        'festival_mess',
                        'fortify_mess',
                        'heal_mess',
                        'demipoint_mess',
                        'gifting_mess',
                        'feats_mess',
                        'demibless_mess',
                        'level_mess',
                        'exp_mess',
                        'debug1_mess',
                        'debug2_mess',
                        'control',
                        'donate'
                    ];

                for (divID = 0, len = divList.length; divID < len; divID += 1) {
                    caapDiv += "<div class='caap_ww' id='caap_" + divList[divID] + "'></div>";
                }

                caapDiv += "</div>";
                caap.controlXY.x = state.getItem('caap_div_menuLeft', '');
                caap.controlXY.y = state.getItem('caap_div_menuTop', $j(caap.controlXY.selector).offset().top);
                styleXY = caap.getControlXY();
                $j(caapDiv).css({
                    width                   : '180px',
                    background              : bgc,
                    opacity                 : state.getItem('StyleOpacityLight', 1),
                    color                   : $u.bestTextColor(bgc),
                    padding                 : "4px",
                    border                  : "2px solid #444",
                    top                     : styleXY.y + 'px',
                    left                    : styleXY.x + 'px',
                    zIndex                  : state.getItem('caap_div_zIndex', '2'),
                    position                : 'absolute'
                }).appendTo(document.body);

                caap.caapDivObject = $j("#caap_div");

                /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
                /*jslint sub: true */
                banner += "<div id='caap_BannerDisplay_hide' style='display: " + (config.getItem('BannerDisplay', true) ? 'block' : 'none') + "'>";
                banner += "<img src='data:image/png;base64," + image64['header'] + "' alt='Castle Age Auto Player' /><br /><hr /></div>";
                caap.setDivContent('banner', banner);

                donate += "<div id='caap_DonateDisplay_hide' style='text-align: center; display: " + (config.getItem('DonateDisplay', true) ? 'block' : 'none') + "'><br /><hr />";
                donate += "<a href='https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=xotic750%40gmail%2ecom&item_name=Castle%20Age%20Auto%20Player&item_number=CAAP&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted'>";
                donate += "<img src='data:image/gif;base64," + image64['donate'] + "' alt='Donate' /></a></div>";
                caap.setDivContent('donate', donate);
                /*jslint sub: false */

                htmlCode += caap.addPauseMenu();
                htmlCode += caap.addDisableMenu();
                htmlCode += caap.addCashHealthMenu();
                htmlCode += caap.addQuestMenu();
                htmlCode += battle.menu();
                htmlCode += monster.menu();
                htmlCode += guild_monster.menu();
                htmlCode += feed.menu();
                //htmlCode += arena.menu();
                if (false) {
                    htmlCode += festival.menu();
                } else {
                    config.setItem("WhenFestival", "Never");
                }

                htmlCode += caap.addReconMenu();
                htmlCode += general.menu();
                htmlCode += caap.addSkillPointsMenu();
                htmlCode += army.menu();
                if (caap.domain.which === 0) {
                    htmlCode += gifting.menu();
                } else {
                    config.setItem("AutoGift", false);
                }

                htmlCode += caap.addAutoOptionsMenu();
                htmlCode += caap.addFestivalOptionsMenu();
                htmlCode += town.menu();
                htmlCode += caap.addOtherOptionsMenu();
                htmlCode += caap.addFooterMenu();

                caap.setDivContent('control', htmlCode);

                caap.checkLastAction(state.getItem('LastAction', 'idle'));
                $j("input[type='button']", caap.caapDivObject).button();
                caap.makeSliderListener("CustStyleOpacityLight", 0.5, 1, 0.01, 1, true);
                caap.makeSliderListener("CustStyleOpacityDark", 0.5, 1, 0.01, 1, true);
                return true;
            } catch (err) {
                $u.error("ERROR in addControl: " + err);
                return false;
            }
        },

        addCaapAjax: function () {
            try {
                caap.tempAjax = true ? $j("<div id='caap_ajax'></div>") : $j("<div id='caap_ajax'></div>").appendTo(document.body);
                return true;
            } catch (err) {
                $u.error("ERROR in addCaapAjax: " + err);
                return false;
            }
        },

        ajax: function (url, cbError, cbSuccess) {
            try {
                $j.ajax({
                    url: url,
                    error:
                        function (XMLHttpRequest, textStatus, errorThrown) {
                            cbError(XMLHttpRequest, textStatus, errorThrown);
                        },
                    success:
                        function (data, textStatus, XMLHttpRequest) {
                            data = caap.tempAjax.html($j('#' + caap.domain.id[caap.domain.which] + 'globalContainer', data.unescapeCAHTML()).html());
                            $u.log(3, "ajaxScan", [data, textStatus, XMLHttpRequest]);
                            cbSuccess(data, textStatus, XMLHttpRequest);
                        }
                });

                return true;
            } catch (err) {
                $u.error("ERROR in ajax: " + err);
                return false;
            }
        },

        addPauseMenu: function () {
            try {
                return "<div id='caapPaused' style='font-weight: bold; display: " + state.getItem('caapPause', 'block') + "'>Paused on mouse click.<br /><a href='javascript:;' id='caapRestart' >Click here to restart</a></div><hr />";
            } catch (err) {
                $u.error("ERROR in addPauseMenu: " + err);
                return '';
            }
        },

        addDisableMenu: function () {
            try {
                var autoRunInstructions = "Disable auto running of CAAP. Stays persistent even on page reload and the autoplayer will not autoplay.",
                    htmlCode = '';

                htmlCode += caap.makeCheckTR("Disable Autoplayer", 'Disabled', false, autoRunInstructions);
                htmlCode += '<hr />';
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in addDisableMenu: " + err);
                return '';
            }
        },

        addCashHealthMenu: function () {
            try {
                var bankInstructions0 = "Minimum cash to keep in the bank. Press tab to save",
                    bankInstructions1 = "Minimum cash to have on hand, press tab to save",
                    bankInstructions2 = "Maximum cash to have on hand, bank anything above this, press tab to save (leave blank to disable).",
                    healthInstructions = "Minimum health to have before healing, press tab to save (leave blank to disable).",
                    healthStamInstructions = "Minimum Stamina to have before healing, press tab to save (leave blank to disable).",
                    bankImmedInstructions = "Bank as soon as possible. May interrupt player and monster battles.",
                    autobuyInstructions = "Automatically buy lands in groups of 10 based on best Return On Investment value.",
                    autosellInstructions = "Automatically sell off any excess lands above your level allowance.",
                    htmlCode = '';

                htmlCode = caap.startToggle('CashandHealth', 'CASH and HEALTH');
                htmlCode += caap.makeCheckTR("Bank Immediately", 'BankImmed', false, bankImmedInstructions);
                htmlCode += caap.makeCheckTR("Auto Buy Lands", 'autoBuyLand', false, autobuyInstructions);
                htmlCode += caap.makeCheckTR("Auto Sell Excess Lands", 'SellLands', false, autosellInstructions);
                htmlCode += caap.makeNumberFormTR("Keep In Bank", 'minInStore', bankInstructions0, 100000, '', '', false, false, 62);
                htmlCode += caap.makeNumberFormTR("Bank Above", 'MaxInCash', bankInstructions2, '', '', '', false, false, 40);
                htmlCode += caap.makeNumberFormTR("But Keep On Hand", 'MinInCash', bankInstructions1, '', '', '', true, false, 40);
                htmlCode += caap.makeNumberFormTR("Heal If Health Below", 'MinToHeal', healthInstructions, '', '', '');
                htmlCode += caap.makeNumberFormTR("Not If Stamina Below", 'MinStamToHeal', healthStamInstructions, '', '', '', true, false);
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in addCashHealthMenu: " + err);
                return '';
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        addQuestMenu: function () {
            try {
                var forceSubGen = "Always do a quest with the Subquest General you selected under the Generals section. NOTE: This will keep the script from automatically switching to the required general for experience of primary quests.",
                    XQuestInstructions = "Start questing when energy is at or above this value.",
                    XMinQuestInstructions = "Stop quest when energy is at or below this value.",
                    questForList = [
                        'Advancement',
                        'Max Influence',
                        'Max Gold',
                        'Max Experience',
                        'Manual'
                    ],
                    questForListInstructions = [
                        'Advancement performs all the main quests in a sub quest area but not the secondary quests.',
                        'Max Influence performs all the main and secondary quests in a sub quest area.',
                        'Max Gold performs the quest in the specific area that yields the highest gold.',
                        'Max Experience performs the quest in the specific area that yields the highest experience.',
                        'Manual performs the specific quest that you have chosen.'
                    ],
                    questAreaList = [
                        'Quest',
                        'Demi Quests',
                        'Atlantis'
                    ],
                    questWhenList = [
                        'Energy Available',
                        'At Max Energy',
                        'At X Energy',
                        'Not Fortifying',
                        'Never'
                    ],
                    questWhenInst = [
                        'Energy Available - will quest whenever you have enough energy.',
                        'At Max Energy - will quest when energy is at max and will burn down all energy when able to level up.',
                        'At X Energy - allows you to set maximum and minimum energy values to start and stop questing. Will burn down all energy when able to level up.',
                        'Not Fortifying - will quest only when your fortify settings are matched.',
                        'Never - disables questing.'
                    ],
                    stopInstructions = "This will stop and remove the chosen quest and set questing to manual.",
                    autoQuestName = state.getItem('AutoQuest', caap.newAutoQuest())['name'],
                    htmlCode = '';

                htmlCode = caap.startToggle('Quests', 'QUEST');
                htmlCode += caap.makeDropDownTR("Quest When", 'WhenQuest', questWhenList, questWhenInst, '', 'Never', false, false, 62);
                htmlCode += caap.startDropHide('WhenQuest', '', 'Never', true);
                htmlCode += caap.startDropHide('WhenQuest', 'XEnergy', 'At X Energy', false);
                htmlCode += caap.makeNumberFormTR("Start At Or Above", 'XQuestEnergy', XQuestInstructions, 1, '', '', true, false);
                htmlCode += caap.makeNumberFormTR("Stop At Or Below", 'XMinQuestEnergy', XMinQuestInstructions, 0, '', '', true, false);
                htmlCode += caap.endDropHide('WhenQuest', 'XEnergy');
                htmlCode += caap.makeDropDownTR("Quest Area", 'QuestArea', questAreaList, '', '', '', false, false, 62);
                switch (config.getItem('QuestArea', questAreaList[0])) {
                case 'Quest':
                    htmlCode += caap.makeDropDownTR("Sub Area", 'QuestSubArea', caap.landQuestList, '', '', '', false, false, 62);
                    break;
                case 'Demi Quests':
                    htmlCode += caap.makeDropDownTR("Sub Area", 'QuestSubArea', caap.demiQuestList, '', '', '', false, false, 62);
                    break;
                default:
                    htmlCode += caap.makeDropDownTR("Sub Area", 'QuestSubArea', caap.atlantisQuestList, '', '', '', false, false, 62);
                    break;
                }

                htmlCode += caap.makeDropDownTR("Quest For", 'WhyQuest', questForList, questForListInstructions, '', '', false, false, 62);
                htmlCode += caap.makeCheckTR("Switch Quest Area", 'switchQuestArea', true, 'Allows switching quest area after Advancement or Max Influence');
                htmlCode += caap.makeCheckTR("Use Only Subquest General", 'ForceSubGeneral', false, forceSubGen);
                htmlCode += caap.makeCheckTR("Quest For Orbs", 'GetOrbs', false, 'Perform the Boss quest in the selected land for orbs you do not have.');
                htmlCode += "<a id='stopAutoQuest' style='display: " + (autoQuestName ? "block" : "none") + "' href='javascript:;' title='" + stopInstructions + "'>";
                htmlCode += (autoQuestName ? "Stop auto quest: " + autoQuestName + " (energy: " + state.getItem('AutoQuest', caap.newAutoQuest())['energy'] + ")" : '');
                htmlCode += "</a>";
                htmlCode += caap.endDropHide('WhenQuest');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in addQuestMenu: " + err);
                return '';
            }
        },
        /*jslint sub: false */

        addReconMenu: function () {
            try {
                // Recon Controls
                var PReconInstructions = "Enable player battle reconnaissance to run " +
                        "as an idle background task. Battle targets will be collected and" +
                        " can be displayed using the 'Target List' selection on the " +
                        "dashboard.",
                    PRRankInstructions = "Provide the number of ranks below you which" +
                        " recon will use to filter targets. This value will be subtracted" +
                        " from your rank to establish the minimum rank that recon will " +
                        "consider as a viable target. Default 3.",
                    PRLevelInstructions = "Provide the number of levels above you " +
                        "which recon will use to filter targets. This value will be added" +
                        " to your level to establish the maximum level that recon will " +
                        "consider as a viable target. Default 10.",
                    PRARBaseInstructions = "This value sets the base for your army " +
                        "ratio calculation. It is basically a multiplier for the army " +
                        "size of a player at your equal level. For example, a value of " +
                        ".5 means you will battle an opponent the same level as you with " +
                        "an army half the size of your army or less. Default 1.",
                    htmlCode = '';

                htmlCode += caap.startToggle('Recon', 'RECON');
                htmlCode += caap.makeCheckTR("Enable Player Recon", 'DoPlayerRecon', false, PReconInstructions);
                htmlCode += caap.startCheckHide('DoPlayerRecon');
                htmlCode += caap.makeNumberFormTR("Limit Target Records", 'LimitTargets', "Maximum number of records to hold.", 100, '', '');
                htmlCode += caap.makeTD('Find battle targets that are:');
                htmlCode += caap.makeNumberFormTR("Not Lower Than Rank Minus", 'ReconPlayerRank', PRRankInstructions, 3, '', '', true, false);
                htmlCode += caap.makeNumberFormTR("Not Higher Than Level Plus", 'ReconPlayerLevel', PRLevelInstructions, 10, '', '', true, false);
                htmlCode += caap.makeNumberFormTR("Not Higher Than X*Army", 'ReconPlayerARBase', PRARBaseInstructions, 1, '', '', true, false);
                htmlCode += caap.endCheckHide('DoPlayerRecon');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in addReconMenu: " + err);
                return '';
            }
        },

        addSkillPointsMenu: function () {
            try {
                var statusInstructions = "Automatically increase attributes when " +
                        "upgrade skill points are available.",
                    statusAdvInstructions = "USE WITH CAUTION: You can use numbers or " +
                        "formulas(ie. level * 2 + 10). Variable keywords include energy, " +
                        "health, stamina, attack, defense, and level. JS functions can be " +
                        "used (Math.min, Math['max'], etc) !!!Remember your math class: " +
                        "'level + 20' not equals 'level * 2 + 10'!!!",
                    statImmedInstructions = "Update Stats Immediately",
                    statSpendAllInstructions = "If selected then spend all possible points and don't save for stamina upgrade.",
                    attrList = [
                        '',
                        'Energy',
                        'Attack',
                        'Defense',
                        'Stamina',
                        'Health'
                    ],
                    it = 0,
                    htmlCode = '';

                htmlCode += caap.startToggle('Status', 'UPGRADE SKILL POINTS');
                htmlCode += caap.makeCheckTR("Auto Add Upgrade Points", 'AutoStat', false, statusInstructions);
                htmlCode += caap.startCheckHide('AutoStat');
                htmlCode += caap.makeCheckTR("Spend All Possible", 'StatSpendAll', false, statSpendAllInstructions);
                htmlCode += caap.makeCheckTR("Upgrade Immediately", 'StatImmed', false, statImmedInstructions);
                htmlCode += caap.makeCheckTR("Advanced Settings <a href='http://userscripts.org/posts/207279' target='_blank' style='color: blue'>(INFO)</a>", 'AutoStatAdv', false, statusAdvInstructions);
                htmlCode += caap.startCheckHide('AutoStatAdv', true);
                for (it = 0; it < 5; it += 1) {
                    htmlCode += caap.startTR();
                    htmlCode += caap.makeTD("Increase", false, false, "width: 27%; display: inline-block;");
                    htmlCode += caap.makeTD(caap.makeDropDown('Attribute' + it, attrList, '', ''), false, false, "width: 40%; display: inline-block;");
                    htmlCode += caap.makeTD("to", false, false, "text-align: center; width: 10%; display: inline-block;");
                    htmlCode += caap.makeTD(caap.makeNumberForm('AttrValue' + it, statusInstructions, 0), false, true, "width: 20%; display: inline-block;");
                    htmlCode += caap.endTR;
                }

                htmlCode += caap.endCheckHide('AutoStatAdv', true);
                htmlCode += caap.startCheckHide('AutoStatAdv');
                for (it = 5; it < 10; it += 1) {
                    htmlCode += caap.startTR();
                    htmlCode += it === 5 ? caap.makeTD("Increase", false, false, "width: 25%; display: inline-block;") : caap.makeTD("Then", false, false, "width: 25%; display: inline-block;");
                    htmlCode += caap.makeTD(caap.makeDropDown('Attribute' + it, attrList, '', '', ''), false, false, "width: 45%; display: inline-block;");
                    htmlCode += caap.makeTD("using", true, false, "width: 25%; display: inline-block;");
                    htmlCode += caap.endTR;
                    htmlCode += caap.makeTD(caap.makeNumberForm('AttrValue' + it, statusInstructions, '', '', 'text', 'width: 97%;'));
                }

                htmlCode += caap.endCheckHide('AutoStatAdv');
                htmlCode += caap.endCheckHide('AutoStat');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in addSkillPointsMenu: " + err);
                return '';
            }
        },

        addAutoOptionsMenu: function () {
            try {
                // Other controls
                var autoAlchemyInstructions1 = "AutoAlchemy will combine all recipes " +
                        "that do not have missing ingredients. By default, it will not " +
                        "combine Battle Hearts recipes.",
                    autoAlchemyInstructions2 = "If for some reason you do not want " +
                        "to skip Battle Hearts",
                    autoPotionsInstructions0 = "Enable or disable the auto consumption " +
                        "of energy and stamina potions.",
                    autoPotionsInstructions1 = "Number of stamina potions at which to " +
                        "begin consuming.",
                    autoPotionsInstructions2 = "Number of stamina potions to keep.",
                    autoPotionsInstructions3 = "Number of energy potions at which to " +
                        "begin consuming.",
                    autoPotionsInstructions4 = "Number of energy potions to keep.",
                    autoPotionsInstructions5 = "Do not consume potions if the " +
                        "experience points to the next level are within this value.",
                    autoBlessList = [
                        'None',
                        'Energy',
                        'Attack',
                        'Defense',
                        'Health',
                        'Stamina'
                    ],
                    autoBlessListInstructions = [
                        'None disables the auto bless feature.',
                        'Energy performs an automatic daily blessing with Ambrosia.',
                        'Attack performs an automatic daily blessing with Malekus.',
                        'Defense performs an automatic daily blessing with Corvintheus.',
                        'Health performs an automatic daily blessing with Aurora.',
                        'Stamina performs an automatic daily blessing with Azeron.'
                    ],
                    htmlCode = '';

                htmlCode += caap.startToggle('Auto', 'AUTO OPTIONS');
                htmlCode += caap.makeDropDownTR("Auto Bless", 'AutoBless', autoBlessList, autoBlessListInstructions, '', '', false, false, 62);
                htmlCode += caap.makeCheckTR('Auto Potions', 'AutoPotions', false, autoPotionsInstructions0);
                htmlCode += caap.startCheckHide('AutoPotions');
                htmlCode += caap.makeNumberFormTR("Spend Stamina At", 'staminaPotionsSpendOver', autoPotionsInstructions1, 39, '', '', true, false);
                htmlCode += caap.makeNumberFormTR("Keep Stamina", 'staminaPotionsKeepUnder', autoPotionsInstructions2, 35, '', '', true, false);
                htmlCode += caap.makeNumberFormTR("Spend Energy At", 'energyPotionsSpendOver', autoPotionsInstructions3, 39, '', '', true, false);
                htmlCode += caap.makeNumberFormTR("Keep Energy", 'energyPotionsKeepUnder', autoPotionsInstructions4, 35, '', '', true, false);
                htmlCode += caap.makeNumberFormTR("Wait If Exp. To Level", 'potionsExperience', autoPotionsInstructions5, 20, '', '', true, false);
                htmlCode += caap.endCheckHide('AutoPotions');
                htmlCode += caap.makeCheckTR('Auto Alchemy', 'AutoAlchemy', false, autoAlchemyInstructions1);
                htmlCode += caap.startCheckHide('AutoAlchemy');
                htmlCode += caap.makeCheckTR('Do Battle Hearts', 'AutoAlchemyHearts', false, autoAlchemyInstructions2, true);
                htmlCode += caap.endCheckHide('AutoAlchemy');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in addAutoOptionsMenu: " + err);
                return '';
            }
        },

        addFestivalOptionsMenu: function () {
            try {
                // Other controls
                var festivalBlessList = [
                        'None',
                        'Energy',
                        'Attack',
                        'Defense',
                        'Health',
                        'Stamina',
                        'Army'
                    ],
                    htmlCode = '';

                htmlCode += caap.startToggle('FestivalOptions', 'FESTIVAL OPTIONS');
                htmlCode += caap.makeDropDownTR("Feats", 'festivalBless', festivalBlessList, '', '', '', false, false, 62);
                htmlCode += caap.makeCheckTR('Enable Tower', 'festivalTower', false, '');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in addFestivalOptionsMenu: " + err);
                return '';
            }
        },

        addOtherOptionsMenu: function () {
            try {
                // Other controls
                var timeInstructions = "Use 24 hour format for displayed times.",
                    titleInstructions0 = "Set the title bar.",
                    titleInstructions1 = "Add the current action.",
                    titleInstructions2 = "Add the player name.",
                    hideAdsInstructions = "Hides the sidebar adverts.",
                    hideAdsIframeInstructions = "Hide the FaceBook Iframe adverts",
                    hideFBChatInstructions = "Hide the FaceBook Chat",
                    newsSummaryInstructions = "Enable or disable the news summary on the index page.",
                    bannerInstructions = "Uncheck if you wish to hide the CAAP banner.",
                    donateInstructions = "Uncheck if you wish to hide the CAAP donate button.",
                    itemTitlesInstructions = "Replaces the CA item titles with more useful tooltips.",
                    goblinHintingInstructions = "When in the Goblin Emporium, CAAP will try to hide items that you require and fade those that may be required.",
                    ingredientsHideInstructions = "Hide the ingredients list on the Alchemy pages.",
                    alchemyShrinkInstructions = "Reduces the size of the item images and shrinks the recipe layout on the Alchemy pages.",
                    keepShrinkInstructions = "Reduces the size of the item images on the Keep pages.",
                    recipeCleanInstructions = "CAAP will try to hide recipes that are no longer required on the Alchemy page and therefore shrink the list further.",
                    recipeCleanCountInstructions = "The number of items to be owned before cleaning the recipe item from the Alchemy page.",
                    bookmarkModeInstructions = "Enable this if you are running CAAP from a bookmark. Disables refreshes and gifting. Note: not recommended for long term operation.",
                    levelupModeInstructions = "Calculates approx. how many XP points you will get from your current stamina and energy and when you have enough of each to level up it will start using them down to 0.",
                    serializeInstructions = "Setting this value allows you to define your Raids and Monsters all within either the Monster Attack Order or Raid Attack Order list boxes. Selection is serialized so that you only have a single selection from the list active at one time.  This is in contrast to the default mode, where you can have an active Raid and an active Monster, both processing independently.",
                    styleList = [
                        'CA Skin',
                        'Original',
                        'Custom',
                        'None'
                    ],
                    htmlCode = '';

                htmlCode += caap.startToggle('Other', 'OTHER OPTIONS');
                htmlCode += caap.makeCheckTR('Display Item Titles', 'enableTitles', true, itemTitlesInstructions);
                htmlCode += caap.makeCheckTR('Do Goblin Hinting', 'goblinHinting', true, goblinHintingInstructions);
                htmlCode += caap.makeCheckTR('Hide Recipe Ingredients', 'enableIngredientsHide', false, ingredientsHideInstructions);
                htmlCode += caap.makeCheckTR('Alchemy Shrink', 'enableAlchemyShrink', true, alchemyShrinkInstructions);
                htmlCode += caap.makeCheckTR('Keep Shrink', 'enableKeepShrink', true, keepShrinkInstructions);
                htmlCode += caap.makeCheckTR('Recipe Clean-Up', 'enableRecipeClean', 1, recipeCleanInstructions);
                htmlCode += caap.startCheckHide('enableRecipeClean');
                htmlCode += caap.makeNumberFormTR("Recipe Count", 'recipeCleanCount', recipeCleanCountInstructions, 1, '', '', true);
                htmlCode += caap.endCheckHide('enableRecipeClean');
                htmlCode += caap.makeCheckTR('Display CAAP Banner', 'BannerDisplay', true, bannerInstructions);
                htmlCode += caap.makeCheckTR('Display CAAP Donate', 'DonateDisplay', true, donateInstructions);
                htmlCode += caap.makeCheckTR('Use 24 Hour Format', 'use24hr', true, timeInstructions);
                htmlCode += caap.makeCheckTR('Set Title', 'SetTitle', false, titleInstructions0);
                htmlCode += caap.startCheckHide('SetTitle');
                htmlCode += caap.makeCheckTR('Display Action', 'SetTitleAction', false, titleInstructions1, true);
                htmlCode += caap.makeCheckTR('Display Name', 'SetTitleName', false, titleInstructions2, true);
                htmlCode += caap.endCheckHide('SetTitle');
                htmlCode += caap.makeCheckTR('Auto Comma Text Areas', 'TextAreaCommas', false, "When enabled, text input areas will be automatically converted to comma seperation");
                if (caap.domain.which === 0) {
                    htmlCode += caap.makeCheckTR('Use CA Background', 'backgroundCA', false, '');
                    //htmlCode += caap.makeCheckTR('Inject CA-Tools', 'injectCATools', false, 'EXPERIMENTAL: Injects the CA-Tools bookmarklet.');
                    htmlCode += caap.makeCheckTR('Hide Sidebar Adverts', 'HideAds', false, hideAdsInstructions);
                    htmlCode += caap.makeCheckTR('Hide FB Iframe Adverts', 'HideAdsIframe', false, hideAdsIframeInstructions);
                    htmlCode += caap.makeCheckTR('Hide FB Chat', 'HideFBChat', false, hideFBChatInstructions);
                }

                htmlCode += caap.makeCheckTR('Enable News Summary', 'NewsSummary', true, newsSummaryInstructions);
                htmlCode += caap.makeDropDownTR("Style", 'DisplayStyle', styleList, '', '', 'CA Skin', false, false, 62);
                htmlCode += caap.startDropHide('DisplayStyle', '', 'Custom');
                htmlCode += caap.makeTD("Running:");
                htmlCode += caap.makeNumberFormTR("Color", 'CustStyleBackgroundLight', '#FFFFFF', '#E0C691', '', 'color', true, false, 40);
                htmlCode += caap.makeSlider('Transparency', "CustStyleOpacityLight", '', 1, true);
                htmlCode += caap.makeTD("Paused:");
                htmlCode += caap.makeNumberFormTR("Color", 'CustStyleBackgroundDark', '#FFFFFF', '#B09060', '', 'color', true, false, 40);
                htmlCode += caap.makeSlider('Transparency', "CustStyleOpacityDark", '', 1, true);
                htmlCode += caap.endDropHide('DisplayStyle');
                if (caap.domain.which === 0) {
                    htmlCode += caap.startTR();
                    htmlCode += caap.makeTD("<input type='button' id='caap_FillArmy' value='Fill Army' style='padding: 0; font-size: 10px; height: 18px' />");
                    htmlCode += caap.endTR;
                }

                htmlCode += caap.makeCheckTR('Advanced', 'AdvancedOptions', false);
                htmlCode += caap.startCheckHide('AdvancedOptions');
                htmlCode += caap.makeCheckTR('Enable Level Up Mode', 'EnableLevelUpMode', true, levelupModeInstructions, true);
                htmlCode += caap.makeCheckTR('Serialize Raid and Monster', 'SerializeRaidsAndMonsters', false, serializeInstructions, true);
                htmlCode += caap.makeCheckTR('Bookmark Mode', 'bookmarkMode', false, bookmarkModeInstructions, true);
                htmlCode += caap.makeNumberFormTR("Reload Frequency", 'ReloadFrequency', 'Changing this will cause longer/shorter refresh rates. Minimum is 8 minutes.', 8, '', '', true, false);
                htmlCode += caap.makeNumberFormTR("Log Level", 'DebugLevel', '', 1, '', '', true, false);
                htmlCode += caap.startTR();
                htmlCode += caap.makeTD("<input type='button' id='caap_ActionList' value='Modify Action Order' style='padding: 0; font-size: 10px; height: 18px' />");
                htmlCode += caap.endTR;
                htmlCode += "<form><fieldset><legend>Database</legend>";
                htmlCode += caap.makeDropDownTR("Which Data", 'DataSelect', caap.exportList(), '', '', 'Config', true, false, 50);
                htmlCode += caap.startTR();
                htmlCode += caap.makeTD("<input type='button' id='caap_ExportData' value='Export' style='padding: 0; font-size: 10px; height: 18px' />", true, false, "display: inline-block;");
                htmlCode += caap.makeTD("<input type='button' id='caap_ImportData' value='Import' style='padding: 0; font-size: 10px; height: 18px' />", true, false, "display: inline-block;");
                htmlCode += caap.makeTD("<input type='button' id='caap_DeleteData' value='Delete' style='padding: 0; font-size: 10px; height: 18px' />", true, false, "display: inline-block;");
                htmlCode += caap.makeCheckTR("Town Item Report BBCode", "townBBCode", true, 'Switches between BBCode for forum posts and a screen viewable table.');
                htmlCode += caap.startTR();
                htmlCode += caap.makeTD("<input type='button' id='caap_TownItemReport' value='Town Item Report' style='padding: 0; font-size: 10px; height: 18px' />", false, false, "text-align: center;");
                htmlCode += caap.endTR;
                htmlCode += caap.endTR;
                htmlCode += "</fieldset></form>";
                htmlCode += caap.endCheckHide('AdvancedOptions');
                htmlCode += caap.endToggle;
                return htmlCode;
            } catch (err) {
                $u.error("ERROR in addOtherOptionsMenu: " + err);
                return '';
            }
        },

        addFooterMenu: function () {
            try {
                var htmlCode = '';
                htmlCode += caap.startTR();
                htmlCode += caap.makeTD("Unlock Menu <input type='button' id='caap_ResetMenuLocation' value='Reset' style='padding: 0; font-size: 10px; height: 18px' />", false, false, "width: 90%; display: inline-block;");
                htmlCode += caap.makeTD("<input type='checkbox' id='unlockMenu' />", false, true, "width: 10%; display: inline-block;");
                htmlCode += caap.endTR;

                if (devVersion === '0') {
                    htmlCode += caap.makeTD("Version: " + caapVersion + " - <a href='http://senses.ws/caap/index.php' target='_blank'>CAAP Forum</a>");
                    if (caap.newVersionAvailable) {
                        htmlCode += caap.makeTD("<a href='http://castle-age-auto-player.googlecode.com/files/Castle-Age-Autoplayer.user.js'>Install new CAAP version: " + state.getItem('SUC_remote_version') + "!</a>");
                    }
                } else {
                    htmlCode += caap.makeTD("Version: " + caapVersion + " d" + devVersion + " - <a href='http://senses.ws/caap/index.php' target='_blank'>CAAP Forum</a>");
                    if (caap.newVersionAvailable) {
                        htmlCode += caap.makeTD("<a href='http://castle-age-auto-player.googlecode.com/svn/trunk/Castle-Age-Autoplayer.user.js'>Install new CAAP version: " + state.getItem('SUC_remote_version') + " d" + state.getItem('DEV_remote_version')  + "!</a>");
                    }
                }

                return htmlCode;
            } catch (err) {
                $u.error("ERROR in addFooterMenu: " + err);
                return '';
            }
        },

        addDashboard: function () {
            try {
                /*-------------------------------------------------------------------------------------\
                 Here is where we construct the HTML for our dashboard. We start by building the outer
                 container and position it within the main container.
                \-------------------------------------------------------------------------------------*/
                var layout      = "<div id='caap_top'>",
                    displayList = [
                        /*'Arena',*/
                        'Army',
                        'Battle Stats',
                        'Feed',
                        'Festival',
                        'Generals Stats',
                        'Gift Queue',
                        'Gifting Stats',
                        'Guild Monster',
                        'Item Stats',
                        'Magic Stats',
                        'Monster',
                        'Soldiers Stats',
                        'Target List',
                        'User Stats'
                    ],
                    displayInst = [
                        /*'Display the Arena battle in progress.',*/
                        'Display your army members, the last time they leveled up and choose priority Elite Guard.',
                        'Display your Battle history statistics, who you fought and if you won or lost.',
                        'Display the monsters that have been seen in your Live Feed and/or Guild Feed that are still valid.',
                        'Display the Festival battle in progress.',
                        'Display information about your Generals.',
                        'Display your current Gift Queue',
                        'Display your Gifting history, how many gifts you have received and returned to a user.',
                        'Guild Monster',
                        'Display information about Items seen in your Black Smith page.',
                        'Display information about Magic seen in your Magic page.',
                        'Display your Monster battles.',
                        'Display information about Soldiers seen in your Soldiers page.',
                        'Display information about Targets that you have performed reconnaissance on.',
                        'Useful informaton about your account and character statistics.'
                    ],
                    styleXY = {
                        x: 0,
                        y: 0
                    },
                    bgc = state.getItem("StyleBackgroundLight", "#E0C961");

                /*-------------------------------------------------------------------------------------\
                 Next we put in our Refresh Monster List button which will only show when we have
                 selected the Monster display.
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_buttonMonster' style='position:absolute;top:0px;left:250px;display:" + (config.getItem('DBDisplay', 'Monster') === 'Monster' ? 'block' : 'none') + "'>";
                layout += "<input type='button' id='caap_refreshMonsters' value='Refresh Monster List' style='padding: 0; font-size: 9px; height: 18px' /></div>";
                /*-------------------------------------------------------------------------------------\
                 Next we put in our Refresh Guild Monster List button which will only show when we have
                 selected the Guild Monster display.
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_buttonGuildMonster' style='position:absolute;top:0px;left:250px;display:" + (config.getItem('DBDisplay', 'Monster') === 'Guild Monster' ? 'block' : 'none') + "'>";
                layout += "<input type='button' id='caap_refreshGuildMonsters' value='Refresh Guild Monster List' style='padding: 0; font-size: 9px; height: 18px' /></div>";
                /*-------------------------------------------------------------------------------------\
                 Next we put in the Clear Target List button which will only show when we have
                 selected the Target List display
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_buttonTargets' style='position:absolute;top:0px;left:250px;display:" + (config.getItem('DBDisplay', 'Monster') === 'Target List' ? 'block' : 'none') + "'>";
                layout += "<input type='button' id='caap_clearTargets' value='Clear Targets List' style='padding: 0; font-size: 9px; height: 18px' /></div>";
                /*-------------------------------------------------------------------------------------\
                 Next we put in the Clear Battle Stats button which will only show when we have
                 selected the Target List display
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_buttonBattle' style='position:absolute;top:0px;left:250px;display:" + (config.getItem('DBDisplay', 'Monster') === 'Battle Stats' ? 'block' : 'none') + "'>";
                layout += "<input type='button' id='caap_clearBattle' value='Clear Battle Stats' style='padding: 0; font-size: 9px; height: 18px' /></div>";
                /*-------------------------------------------------------------------------------------\
                 Next we put in the Clear Gifting Stats button which will only show when we have
                 selected the Target List display
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_buttonGifting' style='position:absolute;top:0px;left:250px;display:" + (config.getItem('DBDisplay', 'Monster') === 'Gifting Stats' ? 'block' : 'none') + "'>";
                layout += "<input type='button' id='caap_clearGifting' value='Clear Gifting Stats' style='padding: 0; font-size: 9px; height: 18px' /></div>";
                /*-------------------------------------------------------------------------------------\
                 Next we put in the Clear Gift Queue button which will only show when we have
                 selected the Target List display
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_buttonGiftQueue' style='position:absolute;top:0px;left:250px;display:" + (config.getItem('DBDisplay', 'Monster') === 'Gift Queue' ? 'block' : 'none') + "'>";
                layout += "<input type='button' id='caap_clearGiftQueue' value='Clear Gift Queue' style='padding: 0; font-size: 9px; height: 18px' /></div>";
                /*-------------------------------------------------------------------------------------\
                 Next we put in the Clear Gifting Stats button which will only show when we have
                 selected the Target List display
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_buttonArmy' style='position:absolute;top:0px;left:250px;display:" + (config.getItem('DBDisplay', 'Monster') === 'Army' ? 'block' : 'none') + "'>";
                layout += "<input type='button' id='caap_getArmy' value='Get Army' style='padding: 0; font-size: 9px; height: 18px' /></div>";
                /*-------------------------------------------------------------------------------------\
                 Then we put in the Live Feed link since we overlay the Castle Age link.
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_buttonFeed' style='position:absolute;top:0px;left:10px;'><input id='caap_liveFeed' type='button' value='Live Feed' style='padding: 0; font-size: 9px; height: 18px' /></div>";
                /*-------------------------------------------------------------------------------------\
                 Then we put in the Live Feed link since we overlay the Castle Age link.
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_buttonCrusaders' style='position:absolute;top:0px;left:80px;'><input id='caap_crusaders' type='button' value='Crusaders' style='padding: 0; font-size: 9px; height: 18px' /></div>";
                /*-------------------------------------------------------------------------------------\
                 We install the display selection box that allows the user to toggle through the
                 available displays.
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_DBDisplay' style='font-size: 9px;position:absolute;top:0px;right:25px;'>Display: ";
                layout += caap.makeDropDown('DBDisplay', displayList, displayInst, '', 'User Stats', "font-size: 9px; min-width: 90px; max-width: 90px; width : 90px;") + "</div>";
                /*-------------------------------------------------------------------------------------\
                 We install the display selection box that allows the user to toggle through the
                 available displays.
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_dashMin' class='ui-icon ui-icon-circle-minus' style='position:absolute;top:0px;right:5px;' title='Minimise' onmouseover='this.style.cursor=\"pointer\";' onmouseout='this.style.cursor=\"default\";'>-</div>";
                /*-------------------------------------------------------------------------------------\
                And here we build our empty content divs.  We display the appropriate div
                depending on which display was selected using the control above
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_infoMonster' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Monster' ? 'block' : 'none') + "'></div>";
                layout += "<div id='caap_guildMonster' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Guild Monster' ? 'block' : 'none') + "'></div>";
                layout += "<div id='caap_infoTargets1' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Target List' ? 'block' : 'none') + "'></div>";
                layout += "<div id='caap_infoBattle' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Battle Stats' ? 'block' : 'none') + "'></div>";
                layout += "<div id='caap_userStats' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'User Stats' ? 'block' : 'none') + "'></div>";
                layout += "<div id='caap_generalsStats' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Generals Stats' ? 'block' : 'none') + "'></div>";
                layout += "<div id='caap_soldiersStats' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Soldiers Stats' ? 'block' : 'none') + "'></div>";
                layout += "<div id='caap_itemStats' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Item Stats' ? 'block' : 'none') + "'></div>";
                layout += "<div id='caap_magicStats' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Magic Stats' ? 'block' : 'none') + "'></div>";
                layout += "<div id='caap_giftStats' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Gifting Stats' ? 'block' : 'none') + "'></div>";
                layout += "<div id='caap_giftQueue' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Gift Queue' ? 'block' : 'none') + "'></div>";
                layout += "<div id='caap_army' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Army' ? 'block' : 'none') + "'></div>";
                //layout += "<div id='caap_arena' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Arena' ? 'block' : 'none') + "'></div>";
                layout += "<div id='caap_festival' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Festival' ? 'block' : 'none') + "'></div>";
                layout += "<div id='caap_feed' style='position:relative;top:15px;width:610px;height:165px;overflow:auto;display:" + (config.getItem('DBDisplay', 'Monster') === 'Feed' ? 'block' : 'none') + "'></div>";
                layout += "</div>";
                /*-------------------------------------------------------------------------------------\
                 No we apply our CSS to our container
                \-------------------------------------------------------------------------------------*/
                caap.dashboardXY.x = state.getItem('caap_top_menuLeft', '');
                caap.dashboardXY.y = state.getItem('caap_top_menuTop', $j(caap.dashboardXY.selector).offset().top - 10);
                styleXY = caap.getDashboardXY();
                $j(layout).css({
                    background              : bgc,
                    color                   : $u.bestTextColor(bgc),
                    padding                 : "5px",
                    height                  : "185px",
                    width                   : "610px",
                    margin                  : "0 auto",
                    opacity                 : state.getItem('StyleOpacityLight', 1),
                    top                     : styleXY.y + 'px',
                    left                    : styleXY.x + 'px',
                    zIndex                  : state.getItem('caap_top_zIndex', 1),
                    position                : 'absolute',
                    display                 : config.getItem("dashMinimised", false) ? 'none' : 'block'
                }).appendTo(document.body);

                caap.caapTopObject = $j('#caap_top');
                $j("input[type='button']", caap.caapTopObject).button();
                return true;
            } catch (err) {
                $u.error("ERROR in addDashboard: " + err);
                return false;
            }
        },

        addDashboardMin: function () {
            try {
                /*-------------------------------------------------------------------------------------\
                 Here is where we construct the HTML for our dashboard. We start by building the outer
                 container and position it within the main container.
                \-------------------------------------------------------------------------------------*/
                var layout      = "<div id='caap_topmin'>",
                    styleXY = {
                        x: 0,
                        y: 0
                    },
                    bgc = state.getItem("StyleBackgroundLight", "#E0C961");

                /*-------------------------------------------------------------------------------------\
                 We install the display selection box that allows the user to toggle through the
                 available displays.
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_dashMax' class='ui-icon ui-icon-circle-plus' style='position:absolute;top:0px;left:0px;' title='Maximise' onmouseover='this.style.cursor=\"pointer\";' onmouseout='this.style.cursor=\"default\";'>-</div>";
                layout += "</div>";
                /*-------------------------------------------------------------------------------------\
                 No we apply our CSS to our container
                \-------------------------------------------------------------------------------------*/
                styleXY = caap.getDashboardXY();
                $j(layout).css({
                    background              : bgc,
                    color                   : $u.bestTextColor(bgc),
                    padding                 : "5px",
                    height                  : "6px",
                    width                   : "6px",
                    margin                  : "0 auto",
                    opacity                 : state.getItem('StyleOpacityLight', 1),
                    top                     : styleXY.y + 'px',
                    left                    : styleXY.x + 'px',
                    zIndex                  : state.getItem('caap_top_zIndex', 1),
                    position                : 'absolute',
                    display                 : config.getItem("dashMinimised", false) ? 'block' : 'none'
                }).appendTo(document.body);

                caap.caapTopMinObject = $j('#caap_topmin');
                return true;
            } catch (err) {
                $u.error("ERROR in addDashboardMin: " + err);
                return false;
            }
        },

        addPlayButton: function () {
            try {
                /*-------------------------------------------------------------------------------------\
                 Here is where we construct the HTML for our dashboard. We start by building the outer
                 container and position it within the main container.
                \-------------------------------------------------------------------------------------*/
                var layout = "<div id='caap_playbuttondiv'>",
                    bgc = state.getItem('StyleBackgroundDark', '#B09060');

                /*-------------------------------------------------------------------------------------\
                 We install the display selection box that allows the user to toggle through the
                 available displays.
                \-------------------------------------------------------------------------------------*/
                layout += "<div id='caap_playbutton' class='ui-icon ui-icon-circle-triangle-e' style='position:absolute;top:0px;left:0px;' title='Resume' onmouseover='this.style.cursor=\"pointer\";' onmouseout='this.style.cursor=\"default\";'>&gt;</div>";
                layout += "</div>";
                /*-------------------------------------------------------------------------------------\
                 No we apply our CSS to our container
                \-------------------------------------------------------------------------------------*/
                $j(layout).css({
                    background              : bgc,
                    color                   : $u.bestTextColor(bgc),
                    padding                 : "5px",
                    height                  : "6px",
                    width                   : "6px",
                    margin                  : "0 auto",
                    opacity                 : state.getItem('StyleOpacityDark', 1),
                    top                     : '0px',
                    left                    : '0px',
                    zIndex                  : '99',
                    position                : 'fixed',
                    display                 : state.getItem('caapPause', 'none')
                }).appendTo(document.body);

                caap.caapPlayButtonDiv = $j('#caap_playbuttondiv');
                return true;
            } catch (err) {
                $u.error("ERROR in addPlayButton: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                      MONSTERS DASHBOARD
        // Display the current monsters and stats
        /////////////////////////////////////////////////////////////////////

        makeTable: function (id, head, body) {
            try {
                if (!$u.hasContent(id) || !$u.isString(id)) {
                    throw "Invalid ID!";
                }

                var html = "<table id='caap_" + id + "_table' class='caap_table'>";
                html += "<thead>" + $u.setContent(head, '') + "</thead>";
                html += "<tbody>" + $u.setContent(body, '') + "</tbody>";
                html += "</table>";
                return html;
            } catch (err) {
                $u.error("ERROR in makeTable: " + err);
                return undefined;
            }
        },

        makeTr: function (data) {
            try {
                return $u.hasContent(data) ? "<tr>" + data + "</tr>" : "";
            } catch (err) {
                $u.error("ERROR in makeTr: " + err);
                return undefined;
            }
        },

        makeTh: function (obj) {
            try {
                var header = {text: '', color: '', bgcolor: '', id: '', title: '', width: ''},
                    type   = " data-type='bestcolor'",
                    html   = '<th';

                header = obj;
                type = $u.hasContent(header.color) ? '' : type;
                header.color = $u.setContent(header.color, $u.bestTextColor(state.getItem("StyleBackgroundLight", "#E0C961")));
                html += $u.hasContent(header.id) ? " id='" + header.id + "'" : '';
                html += $u.hasContent(header.title) ? " title='" + header.title + "'" : '';
                html += type + " style='color:" + header.color + ";" + ($u.hasContent(header.bgcolor) ? "background-color:" + header.bgcolor + ";" : '') + ($u.hasContent(header.width) ? "width:" + header.width + ";" : '') + "'>" + header.text + "</th>";
                return html;
            } catch (err) {
                $u.error("ERROR in makeTh: " + err);
                return undefined;
            }
        },

        makeTd: function (obj) {
            try {
                var data = {text: '', color: '', bgcolor: '', id: '',  title: ''},
                    type = " data-type='bestcolor'",
                    html = '<td';

                data = obj;
                type = $u.hasContent(data.color) ? '' : type;
                data.color = $u.setContent(data.color, $u.bestTextColor(config.getItem("StyleBackgroundLight", "#E0C961")));
                html += $u.hasContent(data.id) ? " id='" + data.id + "'" : '';
                html += $u.hasContent(data.title) ? " title='" + data.title + "'" : '';
                html += type + " style='color:" + data.color + ";" + ($u.hasContent(data.bgcolor) ? "background-color:" + data.bgcolor + ";" : '') + "'>" + data.text + "</td>";
                return html;
            } catch (err) {
                $u.error("ERROR in makeTd: " + err);
                return undefined;
            }
        },

        updateDashboardWaitLog: true,

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        updateDashboard: function (force) {
            try {
                if (config.getItem("dashMinimised", false)) {
                    return false;
                }

                if (caap.caapTopObject.length === 0) {
                    throw "We are missing the Dashboard div!";
                }

                if (!force && !schedule.oneMinuteUpdate('dashboard') && $j('#caap_infoMonster').html()) {
                    if (caap.updateDashboardWaitLog) {
                        $u.log(4, "Dashboard update is waiting on oneMinuteUpdate");
                        caap.updateDashboardWaitLog = false;
                    }

                    return false;
                }

                caap.updateDashboardWaitLog = true;
                $u.log(3, "Updating Dashboard");
                monster.dashboard();
                guild_monster.dashboard();
                //arena.AddArenaDashboard();
                festival.dashboard();
                feed.dashboard();
                army.dashboard();
                battle.dashboard();
                town.dashboard();
                general.dashboard();
                gifting.queue.dashboard();
                gifting.history.dashboard();

                var headers                = [],
                    values                 = [],
                    pp                     = 0,
                    i                      = 0,
                    count                  = 0,
                    userIdLink             = '',
                    userIdLinkInstructions = '',
                    valueCol               = 'red',
                    len                    = 0,
                    data                   = {text: '', color: '', bgcolor: '', id: '', title: ''},
                    handler                = null,
                    head                   = '',
                    body                   = '',
                    row                    = '';

                /*-------------------------------------------------------------------------------------\
                Next we build the HTML to be included into the 'caap_infoTargets1' div. We set our
                table and then build the header row.
                \-------------------------------------------------------------------------------------*/
                if (config.getItem('DBDisplay', '') === 'Target List' && state.getItem("ReconDashUpdate", true)) {
                    head = "";
                    body = "";
                    headers = ['UserId', 'Name',    'Deity',   'BR#',     'WR#',        'Level',    'Army',    'Last Alive'];
                    values  = ['userID', 'nameStr', 'deityNum', 'rankNum', 'warRankNum', 'levelNum', 'armyNum', 'aliveTime'];
                    for (pp = 0; pp < headers.length; pp += 1) {
                        switch (headers[pp]) {
                        case 'UserId':
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '16%'});
                            break;
                        case 'Name':
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '30%'});
                            break;
                        case 'Deity':
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '12%'});
                            break;
                        case 'BR#':
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '7%'});
                            break;
                        case 'WR#':
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '7%'});
                            break;
                        case 'Level':
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '8%'});
                            break;
                        case 'Army':
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '8%'});
                            break;
                        case 'Last Alive':
                            head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: '12%'});
                            break;
                        default:
                        }
                    }

                    head = caap.makeTr(head);
                    for (i = 0, len = caap.reconRecords.length; i < len; i += 1) {
                        row = "";
                        for (pp = 0; pp < values.length; pp += 1) {
                            switch (values[pp]) {
                            case 'userID':
                                userIdLinkInstructions = "Clicking this link will take you to the user keep of " + caap.reconRecords[i][values[pp]];
                                userIdLink = caap.domain.link + "/keep.php?casuser=" + caap.reconRecords[i][values[pp]];
                                data = {
                                    text  : '<span id="caap_targetrecon_' + i + '" title="' + userIdLinkInstructions + '" rlink="' + userIdLink +
                                            '" onmouseover="this.style.cursor=\'pointer\';" onmouseout="this.style.cursor=\'default\';">' + caap.reconRecords[i][values[pp]] + '</span>',
                                    color : 'blue',
                                    id    : '',
                                    title : ''
                                };

                                row += caap.makeTd(data);
                                break;
                            case 'deityNum':
                                row += caap.makeTd({text: caap.demiTable[caap.reconRecords[i][values[pp]] - 1].ucFirst(), color: '', id: '', title: ''});
                                break;
                            case 'rankNum':
                                row += caap.makeTd({text: caap.reconRecords[i][values[pp]], color: '', id: '', title: battle.battleRankTable[caap.reconRecords[i][values[pp]]]});
                                break;
                            case 'warRankNum':
                                row += caap.makeTd({text: caap.reconRecords[i][values[pp]], color: '', id: '', title: battle.warRankTable[caap.reconRecords[i][values[pp]]]});
                                break;
                            case 'aliveTime':
                                data = {
                                    text  : $u.makeTime(caap.reconRecords[i][values[pp]], "d M H:i"),
                                    color : '',
                                    id    : '',
                                    title : ''
                                };

                                row += caap.makeTd(data);
                                break;
                            default:
                                row += caap.makeTd({text: caap.reconRecords[i][values[pp]], color: '', id: '', title: ''});
                            }
                        }

                        body += caap.makeTr(row);
                    }

                    $j("#caap_infoTargets1", caap.caapTopObject).html(
                        $j(caap.makeTable("recon", head, body)).dataTable({
                            "bAutoWidth"    : false,
                            "bFilter"       : false,
                            "bJQueryUI"     : false,
                            "bInfo"         : false,
                            "bLengthChange" : false,
                            "bPaginate"     : false,
                            "bProcessing"   : false,
                            "bStateSave"    : true,
                            "bSortClasses"  : false
                        })
                    );

                    handler = function (e) {
                        var visitUserIdLink = {
                                rlink     : '',
                                arlink    : ''
                            },
                            i   = 0,
                            len = 0;

                        for (i = 0, len = e.target.attributes.length; i < len; i += 1) {
                            if (e.target.attributes[i].nodeName === 'rlink') {
                                visitUserIdLink.rlink = e.target.attributes[i].nodeValue;
                                visitUserIdLink.arlink = visitUserIdLink.rlink.replace(caap.domain.link + "/", "");
                            }
                        }

                        caap.clickAjaxLinkSend(visitUserIdLink.arlink);
                    };

                    $j("span[id*='caap_targetrecon_']", caap.caapTopObject).unbind('click', handler).click(handler);
                    state.setItem("ReconDashUpdate", false);
                }

                /*-------------------------------------------------------------------------------------\
                Next we build the HTML to be included into the 'caap_userStats' div. We set our
                table and then build the header row.
                \-------------------------------------------------------------------------------------*/
                if (config.getItem('DBDisplay', '') === 'User Stats' && state.getItem("UserDashUpdate", true)) {
                    head = "";
                    body = "";
                    headers = ['Name', 'Value', 'Name', 'Value'];
                    for (pp = 0, len = headers.length; pp < len; pp += 1) {
                        head += caap.makeTh({text: headers[pp], color: '', id: '', title: '', width: ''});
                    }

                    head = caap.makeTr(head);
                    row = caap.makeTd({text: 'Facebook ID', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['FBID'], color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Account Name', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['account'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Character Name', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['PlayerName'], color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Energy', color: '', id: '', title: 'Current/Max'});
                    row += caap.makeTd({text: caap.stats['energy']['num'] + '/' + caap.stats['energy']['max'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Level', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['level'], color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Stamina', color: '', id: '', title: 'Current/Max'});
                    row += caap.makeTd({text: caap.stats['stamina']['num'] + '/' + caap.stats['stamina']['max'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Battle Rank', color: '', id: '', title: ''});
                    row += caap.makeTd({text: battle.battleRankTable[caap.stats['rank']['battle']] + ' (' + caap.stats['rank']['battle'] + ')', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Attack', color: '', id: '', title: 'Current/Max'});
                    row += caap.makeTd({text: caap.stats['attack'].addCommas(), color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Battle Rank Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['rank']['battlePoints'].addCommas(), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Defense', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['defense'].addCommas(), color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'War Rank', color: '', id: '', title: ''});
                    row += caap.makeTd({text: battle.warRankTable[caap.stats['rank']['war']] + ' (' + caap.stats['rank']['war'] + ')', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Health', color: '', id: '', title: 'Current/Max'});
                    row += caap.makeTd({text: caap.stats['health']['num'] + '/' + caap.stats['health']['max'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'War Rank Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['rank']['warPoints'].addCommas(), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Army', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['army']['actual'].addCommas(), color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Generals', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['generals']['total'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Generals When Invade', color: '', id: '', title: 'For every 5 army members you have, one of your generals will also join the fight.'});
                    row += caap.makeTd({text: caap.stats['generals']['invade'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Gold In Bank', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '$' + caap.stats['gold']['bank'].addCommas(), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Total Income Per Hour', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '$' + caap.stats['gold']['income'].addCommas(), color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Gold In Cash', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '$' + caap.stats['gold']['cash'].addCommas(), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Upkeep', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '$' + caap.stats['gold']['upkeep'].addCommas(), color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Total Gold', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '$' + caap.stats['gold']['total'].addCommas(), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Cash Flow Per Hour', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '$' + caap.stats['gold']['flow'].addCommas(), color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Skill Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['points']['skill'], color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Energy Potions', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['potions']['energy'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Favor Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['points']['favor'], color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Stamina Potions', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['potions']['stamina'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Experience To Next Level (ETNL)', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['exp']['dif'].addCommas(), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Battle Strength Index (BSI)', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['indicators']['bsi'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Hours To Level (HTL)', color: '', id: '', title: ''});
                    row += caap.makeTd({text: $u.minutes2hours(caap.stats['indicators']['htl']), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Levelling Speed Index (LSI)', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['indicators']['lsi'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Hours Remaining To Level (HRTL)', color: '', id: '', title: ''});
                    row += caap.makeTd({text: $u.minutes2hours(caap.stats['indicators']['hrtl']), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Skill Points Per Level (SPPL)', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['indicators']['sppl'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Expected Next Level (ENL)', color: '', id: '', title: ''});
                    row += caap.makeTd({text: $u.makeTime(caap.stats['indicators']['enl'], schedule.timeStr()), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Attack Power Index (API)', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['indicators']['api'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Defense Power Index (DPI)', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['indicators']['dpi'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Mean Power Index (MPI)', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['indicators']['mpi'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Battles/Wars Won', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['other']['bww'].addCommas(), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Times eliminated', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['other']['te'].addCommas(), color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Battles/Wars Lost', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['other']['bwl'].addCommas(), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Times you eliminated an enemy', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['other']['tee'].addCommas(), color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Battles/Wars Win/Loss Ratio (WLR)', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['other']['wlr'], color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Enemy Eliminated/Eliminated Ratio (EER)', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['other']['eer'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Invasions Won', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['achievements']['battle']['invasions']['won'].addCommas(), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Duels Won', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['achievements']['battle']['duels']['won'].addCommas(), color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Invasions Lost', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['achievements']['battle']['invasions']['lost'].addCommas(), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Duels Lost', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['achievements']['battle']['duels']['lost'].addCommas(), color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Invasions Streak', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['achievements']['battle']['invasions']['streak'].addCommas(), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Duels Streak', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['achievements']['battle']['duels']['streak'].addCommas(), color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Invasions Win/loss Ratio (IWLR)', color: '', id: '', title: ''});
                    if (caap.stats['achievements']['battle']['invasions']['ratio']) {
                        row += caap.makeTd({text: caap.stats['achievements']['battle']['invasions']['ratio'], color: valueCol, id: '', title: ''});
                    } else {
                        row += caap.makeTd({text: caap.stats['achievements']['battle']['invasions']['ratio'], color: valueCol, id: '', title: ''});
                    }

                    row += caap.makeTd({text: 'Duels Win/loss Ratio (DWLR)', color: '', id: '', title: ''});
                    if (caap.stats['achievements']['battle']['duels']['ratio']) {
                        row += caap.makeTd({text: caap.stats['achievements']['battle']['duels']['ratio'], color: valueCol, id: '', title: ''});
                    } else {
                        row += caap.makeTd({text: caap.stats['achievements']['battle']['duels']['ratio'], color: valueCol, id: '', title: ''});
                    }

                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Quests Completed', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['other']['qc'].addCommas(), color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Alchemy Performed', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.stats['achievements']['other']['alchemy'].addCommas(), color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    count = 0;
                    for (pp in caap.stats['achievements']['monster']) {
                        if (caap.stats['achievements']['monster'].hasOwnProperty(pp)) {
                            row = count % 2 === 0 ? '' : row;
                            row += caap.makeTd({text: pp.escapeHTML(), color: '', id: '', title: ''});
                            row += caap.makeTd({text: caap.stats['achievements']['monster'][pp], color: valueCol, id: '', title: ''});
                            body += count % 2 === 1 ? caap.makeTr(row) : '';
                            count += 1;
                        }
                    }

                    if (count % 2 === 1) {
                        row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                        row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                        body += caap.makeTr(row);
                    }

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Ambrosia Daily Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.demi['ambrosia']['daily']['num'] + '/' + caap.demi['ambrosia']['daily']['max'], color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Malekus Daily Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.demi['malekus']['daily']['num'] + '/' + caap.demi['malekus']['daily']['max'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Ambrosia Total Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.demi['ambrosia']['power']['total'], color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Malekus Total Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.demi['malekus']['power']['total'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Corvintheus Daily Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.demi['corvintheus']['daily']['num'] + '/' + caap.demi['corvintheus']['daily']['max'], color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Aurora Daily Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.demi['aurora']['daily']['num'] + '/' + caap.demi['aurora']['daily']['max'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Corvintheus Total Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.demi['corvintheus']['power']['total'], color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: 'Aurora Total Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.demi['aurora']['power']['total'], color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Azeron Daily Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.demi['azeron']['daily']['num'] + '/' + caap.demi['azeron']['daily']['max'], color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: 'Azeron Total Points', color: '', id: '', title: ''});
                    row += caap.makeTd({text: caap.demi['azeron']['power']['total'], color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    row = caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                    row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                    body += caap.makeTr(row);

                    count = 0;
                    for (pp in caap.stats['character']) {
                        if (caap.stats['character'].hasOwnProperty(pp)) {
                            row = count % 2 === 0 ? '' : row;
                            row += caap.makeTd({text: pp, color: '', id: '', title: ''});
                            row += caap.makeTd({text: "Level " + caap.stats['character'][pp]['level'] + " (" + caap.stats['character'][pp]['percent'] + "%)", color: valueCol, id: '', title: ''});
                            body += count % 2 === 1 ? caap.makeTr(row) : '';
                            count += 1;
                        }
                    }

                    if (count % 2 === 1) {
                        row += caap.makeTd({text: '&nbsp;', color: '', id: '', title: ''});
                        row += caap.makeTd({text: '&nbsp;', color: valueCol, id: '', title: ''});
                        body += caap.makeTr(row);
                    }

                    $j("#caap_userStats", caap.caapTopObject).html(caap.makeTable("user", head, body));
                    state.setItem("UserDashUpdate", false);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in updateDashboard: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        /*-------------------------------------------------------------------------------------\
        addDBListener creates the listener for our dashboard controls.
        \-------------------------------------------------------------------------------------*/
        dbDisplayListener: function (e) {
            var idName = e.target.id.stripCaap(),
                value  = e.target.options[e.target.selectedIndex].value,
                title  = e.target.options[e.target.selectedIndex].title;

            $u.log(1, 'Change: setting "' + idName + '" to "' + value + '" with title "' + title + '"');
            config.setItem(idName, value);
            e.target.title = title;
            caap.setDisplay("caapTopObject", 'infoMonster', false);
            caap.setDisplay("caapTopObject", 'guildMonster', false);
            //caap.setDisplay("caapTopObject", 'arena', false);
            caap.setDisplay("caapTopObject", 'festival', false);
            caap.setDisplay("caapTopObject", 'feed', false);
            caap.setDisplay("caapTopObject", 'army', false);
            caap.setDisplay("caapTopObject", 'infoTargets1', false);
            caap.setDisplay("caapTopObject", 'infoBattle', false);
            caap.setDisplay("caapTopObject", 'userStats', false);
            caap.setDisplay("caapTopObject", 'generalsStats', false);
            caap.setDisplay("caapTopObject", 'soldiersStats', false);
            caap.setDisplay("caapTopObject", 'itemStats', false);
            caap.setDisplay("caapTopObject", 'magicStats', false);
            caap.setDisplay("caapTopObject", 'giftStats', false);
            caap.setDisplay("caapTopObject", 'giftQueue', false);
            caap.setDisplay("caapTopObject", 'buttonMonster', false);
            caap.setDisplay("caapTopObject", 'buttonGuildMonster', false);
            caap.setDisplay("caapTopObject", 'buttonTargets', false);
            caap.setDisplay("caapTopObject", 'buttonBattle', false);
            caap.setDisplay("caapTopObject", 'buttonGifting', false);
            caap.setDisplay("caapTopObject", 'buttonGiftQueue', false);
            caap.setDisplay("caapTopObject", 'buttonArmy', false);
            switch (value) {
            case "Target List" :
                caap.setDisplay("caapTopObject", 'infoTargets1', true);
                caap.setDisplay("caapTopObject", 'buttonTargets', true);
                break;
            case "Battle Stats" :
                caap.setDisplay("caapTopObject", 'infoBattle', true);
                caap.setDisplay("caapTopObject", 'buttonBattle', true);
                break;
            case "User Stats" :
                caap.setDisplay("caapTopObject", 'userStats', true);
                break;
            case "Generals Stats" :
                caap.setDisplay("caapTopObject", 'generalsStats', true);
                break;
            case "Soldiers Stats" :
                caap.setDisplay("caapTopObject", 'soldiersStats', true);
                break;
            case "Item Stats" :
                caap.setDisplay("caapTopObject", 'itemStats', true);
                break;
            case "Magic Stats" :
                caap.setDisplay("caapTopObject", 'magicStats', true);
                break;
            case "Gifting Stats" :
                caap.setDisplay("caapTopObject", 'giftStats', true);
                caap.setDisplay("caapTopObject", 'buttonGifting', true);
                break;
            case "Gift Queue" :
                caap.setDisplay("caapTopObject", 'giftQueue', true);
                caap.setDisplay("caapTopObject", 'buttonGiftQueue', true);
                break;
            case "Guild Monster" :
                caap.setDisplay("caapTopObject", 'guildMonster', true);
                caap.setDisplay("caapTopObject", 'buttonGuildMonster', true);
                break;
            case "Monster" :
                caap.setDisplay("caapTopObject", 'infoMonster', true);
                caap.setDisplay("caapTopObject", 'buttonMonster', true);
                break;
            /*case "Arena" :
                caap.setDisplay("caapTopObject", 'arena', true);
                break;*/
            case "Festival" :
                caap.setDisplay("caapTopObject", 'festival', true);
                break;
            case "Feed" :
                caap.setDisplay("caapTopObject", 'feed', true);
                break;
            case "Army" :
                caap.setDisplay("caapTopObject", 'army', true);
                caap.setDisplay("caapTopObject", 'buttonArmy', true);
                break;
            default :
            }

            caap.updateDashboard(true);
        },

        refreshMonstersListener: function (e) {
            monster.flagFullReview();
        },

        refreshGuildMonstersListener: function (e) {
            $u.log(1, "refreshGuildMonstersListener");
            state.setItem('ReleaseControl', true);
            guild_monster.clear();
            caap.updateDashboard(true);
            schedule.setItem("guildMonsterReview", 0);
        },

        liveFeedButtonListener: function (e) {
            caap.clickAjaxLinkSend('army_news_feed.php');
        },

        crusadersButtonListener: function (e) {
            caap.clickAjaxLinkSend('specialmembership.php');
        },

        clearTargetsButtonListener: function (e) {
            caap.reconRecords = [];
            caap.saveRecon();
            caap.updateDashboard(true);
        },

        clearBattleButtonListener: function (e) {
            battle.clear();
            caap.updateDashboard(true);
        },

        clearGiftingButtonListener: function (e) {
            gifting.clear("history");
            caap.updateDashboard(true);
        },

        clearGiftQueueButtonListener: function (e) {
            gifting.clear("queue");
            caap.updateDashboard(true);
        },

        getArmyButtonListener: function (e) {
            schedule.deleteItem("army_member");
            army.deleteTemp();
        },

        addDBListener: function () {
            try {
                $u.log(4, "Adding listeners for caap_top");
                if (!$u.hasContent($j('#caap_DBDisplay', caap.caapTopObject))) {
                    caap.reloadCastleAge();
                }

                $j('#caap_DBDisplay', caap.caapTopObject).bind('change', caap.dbDisplayListener);
                $j('#caap_refreshMonsters', caap.caapTopObject).bind('click', caap.refreshMonstersListener);
                $j('#caap_refreshGuildMonsters', caap.caapTopObject).bind('click', caap.refreshGuildMonstersListener);
                $j('#caap_liveFeed', caap.caapTopObject).bind('click', caap.liveFeedButtonListener);
                $j('#caap_crusaders', caap.caapTopObject).bind('click', caap.crusadersButtonListener);
                $j('#caap_clearTargets', caap.caapTopObject).bind('click', caap.clearTargetsButtonListener);
                $j('#caap_clearBattle', caap.caapTopObject).bind('click', caap.clearBattleButtonListener);
                $j('#caap_clearGifting', caap.caapTopObject).bind('click', caap.clearGiftingButtonListener);
                $j('#caap_clearGiftQueue', caap.caapTopObject).bind('click', caap.clearGiftQueueButtonListener);
                $j('#caap_getArmy', caap.caapTopObject).bind('click', caap.getArmyButtonListener);
                $j('#caap_dashMin', caap.caapTopObject).bind('click', function () {
                    caap.caapTopObject.toggle('fold', {}, '', function () {
                        caap.caapTopMinObject.css('display', 'block');
                    });

                    config.setItem("dashMinimised", true);
                });

                $j('#caap_dashMax', caap.caapTopMinObject).bind('click', function () {
                    caap.caapTopObject.toggle('fold');
                    caap.caapTopMinObject.css('display', 'none');
                    config.setItem("dashMinimised", false);
                });

                $u.log(4, "Listeners added for caap_top");
                return true;
            } catch (err) {
                $u.error("ERROR in addDBListener: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          EVENT LISTENERS
        // Watch for changes and update the controls
        /////////////////////////////////////////////////////////////////////

        setDisplay: function (area, idName, display, quiet) {
            try {
                if (!$u.hasContent(idName) || (!$u.isString(idName) && !$u.isNumber(idName))) {
                    $u.warn("idName", idName);
                    throw "Bad idName!";
                }

                var areaDiv = caap[area];
                if (!$u.hasContent(areaDiv)) {
                    areaDiv = $j(document.body);
                    $u.warn("Unknown area. Using document.body", area);
                }

                areaDiv = $j('#caap_' + idName, areaDiv).css('display', display === true ? 'block' : 'none');
                if (!$u.hasContent(areaDiv) && !quiet) {
                    $u.warn("Unable to find idName in area!", idName, area);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in setDisplay: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checkBoxListener: function (e) {
            try {
                var idName        = e.target.id.stripCaap(),
                    DocumentTitle = '',
                    d             = '',
                    styleXY       = {};

                $u.log(1, "Change: setting '" + idName + "' to ", e.target.checked);
                config.setItem(idName, e.target.checked);
                caap.setDisplay("caapDivObject", idName + '_hide', e.target.checked, true);
                caap.setDisplay("caapDivObject", idName + '_not_hide', !e.target.checked, true);
                switch (idName) {
                case "AutoStatAdv" :
                    $u.log(9, "AutoStatAdv");
                    state.setItem("statsMatch", true);
                    break;
                case "backgroundCA" :
                    if (e.target.checked) {
                        $j("body").css({
                            'background-image'    : "url('http://image4.castleagegame.com/graphics/guild_webpage_bg.jpg')",
                            'background-position' : 'center top',
                            'background-repeat'   : 'no-repeat',
                            'background-color'    : 'black',
                            'margin'              : '0px'
                        });

                        $j("#contentCol").css({
                            'background-color'    : 'black'
                            //'margin'              : '0px auto 0px'
                        });

                        $j("#contentArea").css({
                            'background-image'    : "url('http://image4.castleagegame.com/graphics/ws_middle.jpg')",
                            'padding'             : '0px 10px'
                        });

                        $j("#leftColContainer,#pagelet_canvas_footer_content,#bottomContent").css({
                            'display'    : 'none'
                        });

                        $j("#contentCol").removeClass("clearfix");
                    } else {
                        $j("body").css({
                            'background-image'    : '',
                            'background-position' : '',
                            'background-repeat'   : '',
                            'background-color'    : '',
                            'margin'              : ''
                        });

                        $j("#contentCol").css({
                            'background-color'    : 'white'
                            //'margin'              : '0px auto 0px'
                        });

                        $j("#contentArea").css({
                            'background-image'    : '',
                            'padding'             : ''
                        });

                        $j("#leftColContainer,#pagelet_canvas_footer_content,#bottomContent").css({
                            'display'    : 'block'
                        });

                        $j("#contentCol").addClass("clearfix");
                    }

                    styleXY = caap.getControlXY(true);
                    caap.caapDivObject.css({
                        top  : styleXY.y + 'px',
                        left : styleXY.x + 'px'
                    });

                    styleXY = caap.getDashboardXY(true);
                    caap.caapTopObject.css({
                        top  : styleXY.y + 'px',
                        left : styleXY.x + 'px'
                    });

                    caap.caapTopMinObject.css({
                        top  : styleXY.y + 'px',
                        left : styleXY.x + 'px'
                    });

                    break;
                /*
                case "injectCATools" :
                    if (e.target.checked) {
                        if (caap.domain.which === 0) {
                            caap.injectCATools();
                        }
                    } else {
                        if (caap.domain.which === 0) {
                            caap.reloadCastleAge(true);
                        }
                    }

                    break;
                */
                case "HideAds" :
                    $u.log(9, "HideAds");
                    //$j('.UIStandardFrame_SidebarAds').css('display', e.target.checked ? 'none' : 'block');
                    $j('#rightCol').css('display', e.target.checked ? 'none' : 'block');
                    break;
                case "HideAdsIframe" :
                    $u.log(9, "HideAdsIframe");
                    $j("iframe[name*='fb_iframe']").eq(0).parent().css('display', e.target.checked ? 'none' : 'block');
                    caap.dashboardXY.x = state.getItem('caap_top_menuLeft', '');
                    caap.dashboardXY.y = state.getItem('caap_top_menuTop', $j(caap.dashboardXY.selector).offset().top - 10);
                    styleXY = caap.getDashboardXY();
                    caap.caapTopObject.css({
                        top  : styleXY.y + 'px',
                        left : styleXY.x + 'px'
                    });

                    caap.caapTopMinObject.css({
                        top  : styleXY.y + 'px',
                        left : styleXY.x + 'px'
                    });

                    break;
                case "HideFBChat" :
                    $u.log(9, "HideFBChat");
                    $j("div[class*='fbDockWrapper fbDockWrapperBottom fbDockWrapperRight']").css('display', e.target.checked ? 'none' : 'block');
                    break;
                case "IgnoreBattleLoss" :
                    $u.log(9, "IgnoreBattleLoss");
                    if (e.target.checked) {
                        $u.log(1, "Ignore Battle Losses has been enabled.");
                    }

                    break;
                case "SetTitle" :
                case "SetTitleAction" :
                case "SetTitleName" :
                    $u.log(9, idName);
                    if (e.target.checked) {
                        if (config.getItem('SetTitleAction', false)) {
                            d = $j('#caap_activity_mess', caap.caapDivObject).html();
                            if (d) {
                                DocumentTitle += d.replace("Activity: ", '') + " - ";
                            }
                        }

                        if (config.getItem('SetTitleName', false)) {
                            DocumentTitle += caap.stats['PlayerName'] + " - ";
                        }

                        document.title = DocumentTitle + caap.documentTitle;
                    } else {
                        document.title = caap.documentTitle;
                    }

                    break;
                case "unlockMenu" :
                    $u.log(9, "unlockMenu");
                    if (e.target.checked) {
                        $j(":input[id^='caap_']", caap.caapDivObject).attr({disabled: true});
                        $j(":input[id^='caap_']", caap.caapTopObject).attr({disabled: true});
                        caap.caapDivObject.css('cursor', 'move').draggable({
                            stop: function () {
                                caap.saveControlXY();
                            }
                        });

                        caap.caapTopObject.css('cursor', 'move').draggable({
                            stop: function () {
                                caap.saveDashboardXY();
                                styleXY = caap.getDashboardXY();
                                caap.caapTopMinObject.css({
                                    top  : styleXY.y + 'px',
                                    left : styleXY.x + 'px'
                                });
                            }
                        });
                    } else {
                        caap.caapDivObject.css('cursor', '').draggable("destroy");
                        caap.caapTopObject.css('cursor', '').draggable("destroy");
                        $j(":input[id^='caap_']", caap.caapDivObject).attr({disabled: false});
                        $j(":input[id^='caap_']", caap.caapTopObject).attr({disabled: false});
                    }

                    break;
                case "AutoElite" :
                    $u.log(9, "AutoElite");
                    schedule.setItem('AutoEliteGetList', 0);
                    schedule.setItem('AutoEliteReqNext', 0);
                    state.setItem('AutoEliteEnd', '');
                    state.setItem("MyEliteTodo", []);
                    if (!state.getItem('FillArmy', false)) {
                        state.setItem(caap.friendListType.giftc.name + 'Requested', false);
                        state.setItem(caap.friendListType.giftc.name + 'Responded', []);
                    }

                    if (caap.domain.which === 2 && e.target.checked) {
                        $j("#caap_EnableArmy", caap.caapDivObject).attr("checked", config.setItem("EnableArmy", true));
                        caap.setDisplay("caapDivObject", "EnableArmy" + '_hide', true, true);
                    }

                    break;
                case "AchievementMode" :
                    $u.log(9, "AchievementMode");
                    monster.flagReview();
                    break;
                case "StatSpendAll" :
                    $u.log(9, "StatSpendAll");
                    state.setItem("statsMatch", true);
                    state.setItem("autoStatRuleLog", true);
                    break;
                case "enableTitles" :
                case "goblinHinting" :
                    if (e.target.checked) {
                        spreadsheet.clear();
                        spreadsheet.load();
                    }

                    break;
                case "ignoreClerics" :
                case "chooseIgnoredMinions" :
                    state.setItem('targetGuildMonster', {});
                    state.setItem('staminaGuildMonster', 0);
                    schedule.setItem("guildMonsterReview", 0);
                    break;
                case "festivalTower" :
                    monster.flagFullReview();
                    break;
                default :
                }

                return true;
            } catch (err) {
                $u.error("ERROR in checkBoxListener: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        colorDiv: {},

        colorUpdate: function () {
            try {
                var color = state.getItem('caapPause', 'none') === 'none' ? state.getItem('StyleBackgroundLight', 1) : state.getItem('StyleBackgroundDark', 1),
                    bgo   = state.getItem('caapPause', 'none') === 'none' ? state.getItem('StyleOpacityLight', 1) : state.getItem('StyleOpacityDark', 1),
                    btc   = $u.bestTextColor(color),
                    chk1  = caap.caapDivObject.css('background-color'),
                    chk2  = caap.caapDivObject.css('color');

                if ($u.hex2rgb(color).color !== chk1) {
                    $u.log(4, "Update background color", color, chk1);
                    caap.caapDivObject.css({
                        'background' : color,
                        'opacity'    : bgo,
                        'color'      : btc
                    });

                    caap.caapTopObject.css({
                        'background' : color,
                        'opacity'    : bgo,
                        'color'      : btc
                    });

                    caap.caapTopMinObject.css({
                        'background' : color,
                        'opacity'    : bgo,
                        'color'      : btc
                    });

                    caap.caapPlayButtonDiv.css({
                        'background' : color,
                        'opacity'    : bgo,
                        'color'      : btc
                    });

                    if ($u.hex2rgb(btc).color !== chk2) {
                        $u.log(4, "Update text color", btc, chk2);
                        $j("th[data-type='bestcolor'],td[data-type='bestcolor']", caap.caapTopObject).css({'color': btc});
                    }
                }

                return true;
            } catch (err) {
                $u.error("ERROR in colorUpdate: " + err);
                return false;
            }
        },

        colorBoxClickListener: function (e) {
            try {
                var id = e.target.id.stripCaap(),
                    t  = $j(e.target);

                function fb1call(color) {
                    state.setItem("StyleBackgroundLight", color);
                    caap.colorUpdate();
                }

                function fb2call(color) {
                    state.setItem("StyleBackgroundDark", color);
                    caap.colorUpdate();
                }

                function d1call(el_id, color) {
                    var s = el_id.stripCaap(),
                        v = $u.addSharp(color).toUpperCase(),
                        c = '';

                    if (color !== 'close') {
                        $u.log(1, 'Change: setting "' + s + '" to ', v);
                        config.setItem(s, v);
                    } else {
                        c = config.getItem(s, v);
                        switch (s) {
                        case "CustStyleBackgroundLight" :
                            state.setItem("StyleBackgroundLight", c);
                            caap.colorUpdate();
                            break;
                        case "CustStyleBackgroundDark" :
                            state.setItem("StyleBackgroundDark", c);
                            caap.colorUpdate();
                            break;
                        default :
                        }

                        caap.colorDiv[e.target.id][3].val(c);
                        caap.colorDiv[e.target.id][3].css({
                            background : e.target.value,
                            color      : $u.bestTextColor(e.target.value)
                        });
                    }

                    delete caap.colorDiv[el_id];
                }

                if (!$u.hasContent(caap.colorDiv[e.target.id])) {
                    switch (id) {
                    case "CustStyleBackgroundLight" :
                        caap.colorDiv[e.target.id] = t.colorInput(fb1call, d1call).concat(t);
                        break;
                    case "CustStyleBackgroundDark" :
                        caap.colorDiv[e.target.id] = t.colorInput(fb2call, d1call).concat(t);
                        break;
                    default :
                        caap.colorDiv[e.target.id] = t.colorInput(function () {}, d1call).concat(t);
                    }

                    caap.colorDiv[e.target.id][1].css({
                        background : e.target.value,
                        color      : $u.bestTextColor(e.target.value),
                        padding    : "5px",
                        border     : "2px solid #000000"
                    });
                }

                return true;
            } catch (err) {
                $u.error("ERROR in colorBoxClickListener: " + err);
                return false;
            }
        },

        colorBoxChangeListener: function (e) {
            try {
                e.target.value = $u.addSharp(e.target.value).toUpperCase();
                caap.colorBoxListener(e);
                return true;
            } catch (err) {
                $u.error("ERROR in colorBoxChangeListener: " + err);
                return false;
            }
        },

        colorBoxListener: function (e) {
            try {
                var id  = e.target.id.stripCaap(),
                    val = $u.addSharp(e.target.value).toUpperCase(),
                    c   = new $u.ColorConv();

                e.target.style.backgroundColor = val;
                c.setRgb(e.target.style.backgroundColor);
                e.target.style.color = $u.bestTextColor(c.getHex());
                $u.log(1, 'Change: setting "' + id + '" to ', val);
                config.setItem(id, val);
                if ($u.hasContent(caap.colorDiv[e.target.id])) {
                    caap.colorDiv[e.target.id][2].setColor(val);
                }

                switch (id) {
                case "CustStyleBackgroundLight" :
                    state.setItem("StyleBackgroundLight", val);
                    caap.colorUpdate();
                    break;
                case "CustStyleBackgroundDark" :
                    state.setItem("StyleBackgroundDark", val);
                    caap.colorUpdate();
                    break;
                default :
                }

                return true;
            } catch (err) {
                $u.error("ERROR in colorBoxListener: " + err);
                return false;
            }
        },

        textBoxListener: function (e) {
            try {
                var idName = e.target.id.stripCaap();
                $u.log(1, 'Change: setting "' + idName + '" to ', String(e.target.value));
                if (/AttrValue+/.test(idName)) {
                    state.setItem("statsMatch", true);
                }

                config.setItem(idName, String(e.target.value));
                return true;
            } catch (err) {
                $u.error("ERROR in textBoxListener: " + err);
                return false;
            }
        },

        numberBoxListener: function (e) {
            try {
                var idName  = e.target.id.stripCaap(),
                    number  = null,
                    message = '';

                if ($u.isNaN(e.target.value) && e.target.value !== '') {
                    message = "<div style='text-align: center;'>";
                    message += "You entered:<br /><br />";
                    message += "'" + e.target.value + "'<br /><br />";
                    message += "Please enter a number or leave blank.";
                    message += "</div>";
                    $j().alert(message);
                    number = '';
                } else {
                    number = $u.isNaN(e.target.value) && e.target.value === '' ? '' : e.target.value.parseFloat();
                }

                $u.log(1, 'Change: setting "' + idName + '" to ', number);
                if (/AttrValue+/.test(idName)) {
                    state.setItem("statsMatch", true);
                } else if (/MaxToFortify/.test(idName)) {
                    monster.flagFullReview();
                } else if (/Chain/.test(idName)) {
                    state.getItem('BattleChainId', 0);
                } else if (idName === 'DebugLevel') {
                    $u.set_log_level(e.target.value.parseInt());
                } else if (idName === "IgnoreMinionsBelow") {
                    state.setItem('targetGuildMonster', {});
                    state.setItem('staminaGuildMonster', 0);
                    schedule.setItem("guildMonsterReview", 0);
                }

                e.target.value = config.setItem(idName, number);
                return true;
            } catch (err) {
                $u.error("ERROR in numberBoxListener: " + err);
                return false;
            }
        },

        dropBoxListener: function (e) {
            try {
                if (e.target.selectedIndex > 0) {
                    var idName = e.target.id.stripCaap(),
                        value  = e.target.options[e.target.selectedIndex].value,
                        title  = e.target.options[e.target.selectedIndex].title;

                    $u.log(1, 'Change: setting "' + idName + '" to "' + value + '" with title "' + title + '"');
                    config.setItem(idName, value);
                    e.target.title = title;
                    if (idName.hasIndexOf('When')) {
                        caap.setDisplay("caapDivObject", idName + '_hide', value !== 'Never');
                        if (!idName.hasIndexOf('Quest')) {
                            //if (!idName.hasIndexOf('Arena')) {
                            if (!idName.hasIndexOf('Festival')) {
                                caap.setDisplay("caapDivObject", idName + 'XStamina_hide', value === 'At X Stamina');
                            }

                            caap.setDisplay("caapDivObject", 'WhenBattleStayHidden_hide', ((config.getItem('WhenBattle', 'Never') === 'Stay Hidden' && config.getItem('WhenMonster', 'Never') !== 'Stay Hidden')));
                            caap.setDisplay("caapDivObject", 'WhenMonsterStayHidden_hide', ((config.getItem('WhenMonster', 'Never') === 'Stay Hidden' && config.getItem('WhenBattle', 'Never') !== 'Stay Hidden')));
                            caap.setDisplay("caapDivObject", 'DemiPointsFirst_hide', (config.getItem('WhenBattle', 'Never') === 'Demi Points Only'));
                            switch (idName) {
                            case 'WhenBattle':
                                if (value === 'Never') {
                                    caap.setDivContent('battle_mess', 'Battle off');
                                } else {
                                    caap.setDivContent('battle_mess', '');
                                }

                                break;
                            case 'WhenMonster':
                                if (value === 'Never') {
                                    caap.setDivContent('monster_mess', 'Monster off');
                                } else {
                                    caap.setDivContent('monster_mess', '');
                                }

                                break;
                            case 'WhenGuildMonster':
                                if (value === 'Never') {
                                    caap.setDivContent('guild_monster_mess', 'Guild Monster off');
                                } else {
                                    caap.setDivContent('guild_monster_mess', '');
                                }

                                break;
                            /*case 'WhenArena':
                                if (value === 'Never') {
                                    caap.setDivContent('arena_mess', 'Arena off');
                                } else {
                                    caap.setDivContent('arena_mess', '');
                                }

                                break;*/
                            case 'WhenFestival':
                                if (value === 'Never') {
                                    caap.setDivContent('festival_mess', 'Festival off');
                                } else {
                                    caap.setDivContent('festival_mess', '');
                                }

                                break;
                            default:
                            }
                        } else {
                            caap.setDisplay("caapDivObject", idName + 'XEnergy_hide', value === 'At X Energy');
                        }
                    } else if (idName === 'QuestArea' || idName === 'QuestSubArea' || idName === 'WhyQuest') {
                        state.setItem('AutoQuest', caap.newAutoQuest());
                        caap.clearAutoQuest();
                        if (idName === 'QuestArea') {
                            switch (value) {
                            case "Quest" :
                                caap.changeDropDownList('QuestSubArea', caap.landQuestList);
                                break;
                            case "Demi Quests" :
                                caap.changeDropDownList('QuestSubArea', caap.demiQuestList);
                                break;
                            case "Atlantis" :
                                caap.changeDropDownList('QuestSubArea', caap.atlantisQuestList);
                                break;
                            default :
                            }
                        }
                    } else if (idName === 'BattleType') {
                        state.getItem('BattleChainId', 0);
                    } else if (idName === 'AutoBless' && value === 'None') {
                        schedule.setItem('BlessingTimer', 0);
                    } else if (idName === 'festivalBless' && value === 'None') {
                        schedule.setItem('festivalBlessTimer', 0);
                    } else if (idName === 'TargetType') {
                        state.getItem('BattleChainId', 0);
                        //caap.setDisplay("caapDivObject", 'TargetTypeFreshmeat_hide', value === "Freshmeat");
                        caap.setDisplay("caapDivObject", 'TargetTypeUserId_hide', value === "Userid List");
                        caap.setDisplay("caapDivObject", 'TargetTypeRaid_hide', value === "Raid");
                    } else if (idName === 'LevelUpGeneral') {
                        caap.setDisplay("caapDivObject", idName + '_hide', value !== 'Use Current');
                    } else if (/Attribute?/.test(idName)) {
                        state.setItem("statsMatch", true);
                    /*} else if (idName === 'chainArena') {
                        caap.setDisplay("caapDivObject", idName + '_hide', value !== '0');*/
                    } else if (idName === 'chainFestival') {
                        caap.setDisplay("caapDivObject", idName + '_hide', value !== '0');
                    } else if (idName === 'DisplayStyle') {
                        caap.setDisplay("caapDivObject", idName + '_hide', value === 'Custom');
                        switch (value) {
                        case "Original" :
                            state.setItem("StyleBackgroundLight", "#EFEFFF");
                            state.setItem("StyleBackgroundDark", "#FEEFFF");
                            state.setItem("StyleOpacityLight", 1);
                            state.setItem("StyleOpacityDark", 1);
                            break;
                        case "None" :
                            state.setItem("StyleBackgroundLight", "#FFFFFF");
                            state.setItem("StyleBackgroundDark", "#FFFFFF");
                            state.setItem("StyleOpacityLight", 1);
                            state.setItem("StyleOpacityDark", 1);
                            break;
                        case "Custom" :
                            state.setItem("StyleBackgroundLight", config.getItem("CustStyleBackgroundLight", "#E0C691"));
                            state.setItem("StyleBackgroundDark", config.getItem("CustStyleBackgroundDark", "#B09060"));
                            state.setItem("StyleOpacityLight", config.getItem("CustStyleOpacityLight", 1));
                            state.setItem("StyleOpacityDark", config.getItem("CustStyleOpacityDark", 1));
                            break;
                        default :
                            state.setItem("StyleBackgroundLight", "#E0C691");
                            state.setItem("StyleBackgroundDark", "#B09060");
                            state.setItem("StyleOpacityLight", 1);
                            state.setItem("StyleOpacityDark", 1);
                        }

                        caap.colorUpdate();
                    }
                }

                return true;
            } catch (err) {
                $u.error("ERROR in dropBoxListener: " + err);
                return false;
            }
        },

        textAreaListener: function (e) {
            try {
                var idName = e.target.id.stripCaap(),
                    value  = e.target.value;

                function commas() {
                    // Change the boolean from false to true to enable BoJangles patch or
                    // set the hidden variable in localStorage
                    if (config.getItem("TextAreaCommas", false)) {
                        // This first removes leading and trailing white space and/or commas before
                        // both removing and inserting commas where appropriate.
                        // Handles adding a single user id as well as replacing the entire list.
                        e.target.value = value.replace(/(^[,\s]+)|([,\s]+$)/g, "").replace(/[,\s]+/g, ",");
                    }
                }

                $u.log(1, 'Change: setting "' + idName + '" to ', e.target.value);
                config.setItem(idName, e.target.value);
                switch (idName) {
                case "orderGuildMinion":
                case "orderGuildMonster":
                    state.setItem('targetGuildMonster', {});
                    state.setItem('staminaGuildMonster', 0);
                    schedule.setItem("guildMonsterReview", 0);
                    break;
                case "orderbattle_monster":
                case "orderraid":
                    monster.flagFullReview();
                    break;
                case "BattleTargets":
                    state.setItem('BattleChainId', 0);
                    commas();
                    break;
                case "EliteArmyList":
                    commas();
                    break;
                default:
                }

                return true;
            } catch (err) {
                $u.error("ERROR in textAreaListener: " + err);
                return false;
            }
        },

        pauseListener: function (e) {
            var bgc = state.getItem('StyleBackgroundDark', '#B09060'),
                bgo = state.getItem('StyleOpacityDark', 1),
                btc = $u.bestTextColor(bgc),
                chk = $u.bestTextColor(state.getItem('StyleBackgroundLight', '#E0C691'));

            caap.caapDivObject.css({
                'background' : bgc,
                'color'      : btc,
                'opacity'    : bgo,
                'z-index'    : '3'
            });

            caap.caapTopObject.css({
                'background' : bgc,
                'color'      : btc,
                'opacity'    : bgo
            });

            caap.caapTopMinObject.css({
                'background' : bgc,
                'color'      : btc,
                'opacity'    : bgo
            });

            if (btc !== chk) {
                $j("th[data-type='bestcolor'],td[data-type='bestcolor']", caap.caapTopObject).css({'color': btc});
            }

            $j('#caapPaused', caap.caapDivObject).css('display', 'block');
            caap.caapPlayButtonDiv.css('display', 'block');
            state.setItem('caapPause', 'block');
        },

        restartListener: function (e) {
            var bgc = state.getItem('StyleBackgroundLight', '#E0C691'),
                bgo = state.getItem('StyleOpacityLight', 1),
                btc = $u.bestTextColor(bgc),
                chk = $u.bestTextColor(state.getItem('StyleBackgroundDark', '#B09060'));

            $j('#caapPaused', caap.caapDivObject).css('display', 'none');
            caap.caapPlayButtonDiv.css('display', 'none');
            caap.caapDivObject.css({
                'background' : bgc,
                'color'      : btc,
                'opacity'    : bgo,
                'z-index'    : state.getItem('caap_div_zIndex', '2'),
                'cursor'     : ''
            });

            caap.caapTopObject.css({
                'background' : bgc,
                'color'      : btc,
                'opacity'    : bgo,
                'z-index'    : state.getItem('caap_top_zIndex', '1'),
                'cursor'     : ''
            });

            caap.caapTopMinObject.css({
                'background' : bgc,
                'color'      : btc,
                'opacity'    : bgo,
                'z-index'    : state.getItem('caap_top_zIndex', '1'),
                'cursor'     : ''
            });

            if (btc !== chk) {
                $j("th[data-type='bestcolor'],td[data-type='bestcolor']", caap.caapTopObject).css({'color': btc});
            }

            $j('#unlockMenu', caap.caapDivObject).attr('checked', false);
            state.setItem('caapPause', 'none');
            state.setItem('ReleaseControl', true);
            state.setItem('resetselectMonster', true);
            state.setItem('resetselectGuildMonster', true);
            caap.waitingForDomLoad = false;
        },

        resetMenuLocationListener: function (e) {
            var caap_divXY = {},
                caap_topXY = {};

            state.deleteItem('caap_div_menuLeft');
            state.deleteItem('caap_div_menuTop');
            state.deleteItem('caap_div_zIndex');
            caap.controlXY.x = '';
            caap.controlXY.y = $j(caap.controlXY.selector).offset().top;
            caap_divXY = caap.getControlXY(true);
            caap.caapDivObject.css({
                'cursor'  : '',
                'z-index' : '2',
                'top'     : caap_divXY.y + 'px',
                'left'    : caap_divXY.x + 'px'
            });

            state.deleteItem('caap_top_menuLeft');
            state.deleteItem('caap_top_menuTop');
            state.deleteItem('caap_top_zIndex');
            caap.dashboardXY.x = '';
            caap.dashboardXY.y = $j(caap.dashboardXY.selector).offset().top - 10;
            caap_topXY = caap.getDashboardXY(true);
            caap.caapTopObject.css({
                'cursor' : '',
                'z-index' : '1',
                'top' : caap_topXY.y + 'px',
                'left' : caap_topXY.x + 'px'
            });

            caap.caapTopMinObject.css({
                'cursor' : '',
                'z-index' : '1',
                'top' : caap_topXY.y + 'px',
                'left' : caap_topXY.x + 'px'
            });

            $j(":input[id^='caap_']", caap.caapDivObject).attr({disabled: false});
            $j(":input[id^='caap_']", caap.caapTopObject).attr({disabled: false});
        },

        foldingBlockListener: function (e) {
            try {
                var subId  = e.target.id.replace(/_Switch/i, ''),
                    subDiv = document.getElementById(subId);

                if (subDiv.style.display === "block") {
                    $u.log(2, 'Folding: ', subId);
                    subDiv.style.display = "none";
                    e.target.innerHTML = e.target.innerHTML.replace(/-/, '+');
                    state.setItem('Control_' + subId.stripCaap(), "none");
                } else {
                    $u.log(2, 'Unfolding: ', subId);
                    subDiv.style.display = "block";
                    e.target.innerHTML = e.target.innerHTML.replace(/\+/, '-');
                    state.setItem('Control_' + subId.stripCaap(), "block");
                }

                return true;
            } catch (err) {
                $u.error("ERROR in foldingBlockListener: " + err);
                return false;
            }
        },

        whatClickedURLListener: function (event) {
            try {
                var obj = event.target;
                while (obj && !obj.href) {
                    obj = obj.parentNode;
                }

                if (obj && obj.href) {
                    state.setItem('clickUrl', obj.href);
                    schedule.setItem('clickedOnSomething', 0);
                    caap.waitingForDomLoad = true;
                    //$u.log(9, 'globalContainer', obj.href);
                } else {
                    if (obj && !obj.href) {
                        $u.warn('whatClickedURLListener globalContainer no href', obj);
                    }
                }
            } catch (err) {
                $u.error("ERROR in whatClickedURLListener: " + err, event);
            }
        },

        whatFriendBox: function (event) {
            try {
                var obj    = event.target,
                    userID = 0;

                while (obj && !obj.id) {
                    obj = obj.parentNode;
                }

                if (obj && obj.id && obj.onclick) {
                    userID = obj.onclick.toString().regex(/friendKeepBrowse\('(\d+)'/);
                    state.setItem('clickUrl', caap.domain.link + '/keep.php' + ($u.isNumber(userID) && userID > 0 ? "?casuser=" + userID : ''));
                    schedule.setItem('clickedOnSomething', 0);
                    caap.waitingForDomLoad = true;
                }
            } catch (err) {
                $u.error("ERROR in whatFriendBox: " + err, event);
            }
        },

        guildMonsterEngageListener: function (event) {
            $u.log(4, "engage guild_battle_monster.php");
            state.setItem('clickUrl', caap.domain.link + '/guild_battle_monster.php');
            schedule.setItem('clickedOnSomething', 0);
            caap.waitingForDomLoad = true;
        },

        windowResizeListener: function (e) {
            if (caap.domain.which >= 0) {
                var caap_divXY = caap.getControlXY(),
                    caap_topXY = caap.getDashboardXY();

                caap.caapDivObject.css('left', caap_divXY.x + 'px');
                caap.caapTopObject.css('left', caap_topXY.x + 'px');
                caap.caapTopMinObject.css('left', caap_topXY.x + 'px');
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        goldTimeListener: function (e) {
            var tArr = $u.setContent($u.setContent($j(e.target).text(), '').regex(/(\d+):(\d+)/), []);
            if (!$u.hasContent(tArr) || tArr.length !== 2) {
                return;
            }

            caap.stats['gold']['ticker'] = tArr;
            if (tArr[1] === 0 || $u.get_log_level() >= 4) {
                $u.log(3, "goldTimeListener", tArr[0] + ":" + (tArr[1] < 10 ? '0' + tArr[1] : tArr[1]));
            }
        },

        energyListener: function (e) {
            var num = $u.setContent($u.setContent($j(e.target).text(), '').parseInt(), -1);
            if (num < 0 || $u.isNaN(num)) {
                return;
            }

            caap.stats['energy'] = $u.setContent(caap.getStatusNumbers(num + "/" + caap.stats['energy']['max']), caap.stats['energy']);
            caap.stats['energyT'] = $u.setContent(caap.getStatusNumbers(num + "/" + caap.stats['energyT']['max']), caap.stats['energy']);
            $u.log(3, "energyListener", num);
        },

        healthListener: function (e) {
            var num = $u.setContent($u.setContent($j(e.target).text(), '').parseInt(), -1);
            if (num < 0 || $u.isNaN(num)) {
                return;
            }

            caap.stats['health'] = $u.setContent(caap.getStatusNumbers(num + "/" + caap.stats['health']['max']), caap.stats['health']);
            caap.stats['healthT'] = $u.setContent(caap.getStatusNumbers(num + "/" + caap.stats['healthT']['max']), caap.stats['healthT']);
            $u.log(3, "healthListener", num);
        },

        staminaListener: function (e) {
            var num = $u.setContent($u.setContent($j(e.target).text(), '').parseInt(), -1);
            if (num < 0 || $u.isNaN(num)) {
                return;
            }

            caap.stats['stamina'] = $u.setContent(caap.getStatusNumbers(num + "/" + caap.stats['stamina']['max']), caap.stats['stamina']);
            caap.stats['staminaT'] = $u.setContent(caap.getStatusNumbers(num + "/" + caap.stats['staminaT']['max']), caap.stats['staminaT']);
            $u.log(3, "staminaListener", num);
        },
        /*jslint sub: false */

        caTools: false,

        reBind: function () {
            try {
                $j('a', caap.globalContainer).unbind('click', caap.whatClickedURLListener).bind('click', caap.whatClickedURLListener);
                $j("div[id*='friend_box_']", caap.globalContainer).unbind('click', caap.whatFriendBox).bind('click', caap.whatFriendBox);
                if (caap.isDOMSubtreeModifiedSupported) {
                    $u.log(3, "reBind sts");
                    $j("span[id*='gold_time_value']", caap.globalContainer).unbind('DOMSubtreeModified', caap.goldTimeListener).bind('DOMSubtreeModified', caap.goldTimeListener);
                    $j("span[id*='energy_current_value']", caap.globalContainer).unbind('DOMSubtreeModified', caap.energyListener).bind('DOMSubtreeModified', caap.energyListener);
                    $j("span[id*='stamina_current_value']", caap.globalContainer).unbind('DOMSubtreeModified', caap.staminaListener).bind('DOMSubtreeModified', caap.staminaListener);
                    $j("span[id*='health_current_value']", caap.globalContainer).unbind('DOMSubtreeModified', caap.healthListener).bind('DOMSubtreeModified', caap.healthListener);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in whatFriendBox: " + err, event);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        addListeners: function () {
            try {
                if (!$u.hasContent(caap.caapDivObject)) {
                    throw "Unable to find div for caap_div";
                }

                $j(window).bind('resize', caap.windowResizeListener);
                $j('input:checkbox[id^="caap_"]', caap.caapDivObject).change(caap.checkBoxListener);
                $j('input[data-subtype="text"]', caap.caapDivObject).change(caap.textBoxListener);
                $j('input[data-subtype="color"]', caap.caapDivObject).keyup(caap.colorBoxListener).change(caap.colorBoxChangeListener).click(caap.colorBoxClickListener);
                $j('input[data-subtype="number"]', caap.caapDivObject).change(caap.numberBoxListener);
                $j('#caap_TownBestReport', caap.caapDivObject).click(town.runReport);
                $j('#unlockMenu', caap.caapDivObject).change(caap.checkBoxListener);
                $j('select[id^="caap_"]', caap.caapDivObject).change(caap.dropBoxListener);
                $j('textarea[id^="caap_"]', caap.caapDivObject).change(caap.textAreaListener);
                $j('a[id^="caap_Switch"]', caap.caapDivObject).click(caap.foldingBlockListener);
                $j('#caap_ImportData', caap.caapDivObject).click(function () {
                    caap.importDialog($u.setContent($j('#caap_DataSelect', caap.caapDivObject).val(), 'Config'));
                });

                $j('#caap_ExportData', caap.caapDivObject).click(function () {
                    var val = $u.setContent($j('#caap_DataSelect', caap.caapDivObject).val(), 'Config');
                    caap.exportDialog(caap.exportTable[val]['export'](), val);
                });

                $j('#caap_DeleteData', caap.caapDivObject).click(function () {
                    caap.deleteDialog($u.setContent($j('#caap_DataSelect', caap.caapDivObject).val(), 'Config'));
                });

                $j('#caap_TownItemReport', caap.caapDivObject).click(town.report);
                $j('#caap_ActionList', caap.caapDivObject).click(caap.actionDialog);
                $j('#caap_FillArmy', caap.caapDivObject).click(function (e) {
                    state.setItem("FillArmy", true);
                    state.setItem("ArmyCount", 0);
                    state.setItem('FillArmyList', []);
                    state.setItem(caap.friendListType.giftc.name + 'Responded', []);
                    state.setItem(caap.friendListType.facebook.name + 'Responded', false);

                });

                $j('#caap_ResetMenuLocation', caap.caapDivObject).click(caap.resetMenuLocationListener);
                $j('#caap_resetElite', caap.caapDivObject).click(function (e) {
                    schedule.setItem('AutoEliteGetList', 0);
                    schedule.setItem('AutoEliteReqNext', 0);
                    state.setItem('AutoEliteEnd', '');
                    if (!state.getItem('FillArmy', false)) {
                        state.setItem(caap.friendListType.giftc.name + 'Requested', false);
                        state.setItem(caap.friendListType.giftc.name + 'Responded', []);
                    }
                });

                $j('#caapRestart', caap.caapDivObject).click(caap.restartListener);
                $j('#caap_playbutton', caap.caapPlayButtonDiv).bind('click', caap.restartListener);
                $j('#caap_control', caap.caapDivObject).mousedown(caap.pauseListener);
                $j('#stopAutoQuest', caap.caapDivObject).click(function (e) {
                    $u.log(1, 'Change: setting stopAutoQuest and go to Manual');
                    caap.manualAutoQuest();
                });

                $j(".UIStandardFrame_Content").bind('DOMNodeInserted', function (event) {
                    if (event.target.id !== 'CA-Tools') {
                        return;
                    }

                    $u.log(1, "CA-Tools detected! Changing layout.");
                    caap.caTools = true;
                    $j('#CA-Tools a').bind('click', caap.whatClickedURLListener);
                    window.setTimeout(function () {
                        var styleXY = caap.getControlXY(true, true);
                        caap.caapDivObject.css({
                            top  : styleXY.y + 'px',
                            left : styleXY.x + 'px'
                        });

                        styleXY = caap.getDashboardXY(true);
                        caap.caapTopObject.css({
                            top  : styleXY.y + 'px',
                            left : styleXY.x + 'px'
                        });

                        caap.caapTopMinObject.css({
                            top  : styleXY.y + 'px',
                            left : styleXY.x + 'px'
                        });
                    }, 2000);
                });

                caap.globalContainer = $j('#' + caap.domain.id[caap.domain.which] + 'globalContainer');
                if (!$u.hasContent(caap.globalContainer)) {
                    throw 'Global Container not found';
                }

                // Fires once when page loads
                $j('a', caap.globalContainer).bind('click', caap.whatClickedURLListener);
                $j("div[id*='friend_box_']", caap.globalContainer).bind('click', caap.whatFriendBox);
                if (caap.isDOMSubtreeModifiedSupported) {
                    $u.log(3, "Bind sts onload");
                    $j("span[id*='gold_time_value']", caap.globalContainer).bind('DOMSubtreeModified', caap.goldTimeListener);
                    $j("span[id*='energy_current_value']", caap.globalContainer).bind('DOMSubtreeModified', caap.energyListener);
                    $j("span[id*='stamina_current_value']", caap.globalContainer).bind('DOMSubtreeModified', caap.staminaListener);
                    $j("span[id*='health_current_value']", caap.globalContainer).bind('DOMSubtreeModified', caap.healthListener);
                }

                //arena.addListeners();
                festival.addListeners();

                caap.globalContainer.bind('DOMNodeInserted', function (event) {
                    var tId        = $u.hasContent(event.target.id) ? event.target.id.replace('app46755028429_', '') : event.target.id,
                        targetList = [
                            "app_body",
                            "index",
                            "keep",
                            "generals",
                            "battle_monster",
                            "player_monster_list",
                            "public_monster_list",
                            "battle",
                            "battlerank",
                            "battle_train",
                            "quests",
                            "raid",
                            "party",
                            "symbolquests",
                            "alchemy",
                            "goblin_emp",
                            "soldiers",
                            "item",
                            "land",
                            "magic",
                            "oracle",
                            "symbols",
                            "treasure_chest",
                            "gift",
                            "war_council",
                            "apprentice",
                            "news",
                            "friend_page",
                            "party",
                            "comments",
                            "army",
                            "army_member",
                            "army_news_feed",
                            "army_reqs",
                            "guild",
                            "guild_panel",
                            "guild_shop",
                            "guild_class",
                            "guild_formation",
                            "guild_monster_summon",
                            "guild_current_battles",
                            "guild_current_monster_battles",
                            "guild_battle_monster",
                            "guild_monster_summon_list",
                            "arena",
                            "arena_battle",
                            "specialmembership",
                            "festival_home",
                            "festival_feat_nav",
                            "festival_challenge",
                            "festival_achievements",
                            "festival_battle_home",
                            "festival_guild_battle",
                            "festival_battle_rank",
                            "festival_tower",
                            "festival_battle_monster"
                        ];

                    // Uncomment this to see the id of domNodes that are inserted
                    /*
                    if (event.target.id && !event.target.id.match(/globalContainer/) && !event.target.id.match(/time/i) && !event.target.id.match(/ticker/i) && !event.target.id.match(/caap/i)) {
                        caap.setDivContent('debug2_mess', tId);
                        alert(event.target.id);
                    }
                    */

                    if (targetList.hasIndexOf(tId)) {
                        $u.log(4, "DOM load target matched", tId);
                        caap.waitingForDomLoad = false;
                        caap.incrementPageLoadCounter();
                        caap.reBind();
                        if (caap.domain.which === 0 && config.getItem('HideAdsIframe', false)) {
                            $j("iframe[name*='fb_iframe']").eq(0).parent().css('display', 'none');
                        }

                        caap.delayMain = true;
                        window.setTimeout(function () {
                            caap.checkResults();
                            caap.delayMain = false;
                        }, 750);
                    }

                    // Reposition the dashboard
                    if (event.target.id === caap.dashboardXY.selector.replace("#", '')) {
                        caap.caapTopObject.css('left', caap.getDashboardXY().x + 'px');
                        caap.caapTopMinObject.css('left', caap.getDashboardXY().x + 'px');
                    }
                });

                return true;
            } catch (err) {
                $u.error("ERROR in addListeners: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          CHECK RESULTS
        // Called each iteration of main loop, this does passive checks for
        // results to update other functions.
        /////////////////////////////////////////////////////////////////////

        pageList: {
            'castle_age': {
                signaturePic: 'gif',
                CheckResultsFunction: 'checkResults_index'
            },
            'index': {
                signaturePic: 'gif',
                CheckResultsFunction: 'checkResults_index'
            },
            'battle_monster': {
                signaturePic: 'tab_monster_list_on.gif',
                CheckResultsFunction: 'checkResults_fightList',
                subpages: ['onMonster']
            },
            'player_monster_list': {
                signaturePic: 'monster_button_yourmonster_on.jpg',
                CheckResultsFunction: 'checkResults_fightList',
                subpages: ['onMonster']
            },
            'public_monster_list': {
                signaturePic: 'monster_button_pubmonster_on.jpg',
                CheckResultsFunction: 'checkResults_public_monster_list'
            },
            'onMonster': {
                signaturePic: 'tab_monster_active.gif',
                CheckResultsFunction: 'checkResults_viewFight'
            },
            'raid': {
                signaturePic: 'tab_raid_on.gif',
                CheckResultsFunction: 'checkResults_fightList',
                subpages: ['onRaid']
            },
            'onRaid': {
                signaturePic: 'raid_map',
                CheckResultsFunction : 'checkResults_viewFight'
            },
            'land': {
                signaturePic: 'tab_land_on.gif',
                CheckResultsFunction: 'checkResults_land'
            },
            'generals': {
                signaturePic: 'tab_generals_on.gif',
                CheckResultsFunction: 'checkResults_generals'
            },
            'quests': {
                signaturePic: 'tab_quest_on.gif',
                CheckResultsFunction: 'checkResults_quests',
                subpages: ['earlyQuest']
            },
            'earlyQuest': {
                signaturePic: 'quest_back_1.jpg',
                CheckResultsFunction: 'checkResults_quests'
            },
            'symbolquests': {
                signaturePic: 'demi_quest_on.gif',
                CheckResultsFunction: 'checkResults_quests'
            },
            'monster_quests': {
                signaturePic: 'tab_atlantis_on.gif',
                CheckResultsFunction: 'checkResults_quests'
            },
            'gift_accept': {
                signaturePic: 'gif',
                CheckResultsFunction: 'checkResults_gift_accept'
            },
            'army': {
                signaturePic: 'invite_on.gif',
                CheckResultsFunction: 'checkResults_army'
            },
            'keep': {
                signaturePic: 'tab_stats_on.gif',
                CheckResultsFunction: 'checkResults_keep'
            },
            'oracle': {
                signaturePic: 'oracle_on.gif',
                CheckResultsFunction: 'checkResults_oracle'
            },
            'alchemy': {
                signaturePic: 'tab_alchemy_on.gif',
                CheckResultsFunction: 'checkResults_alchemy'
            },
            'battlerank': {
                signaturePic: 'tab_battle_rank_on.gif',
                CheckResultsFunction: 'checkResults_battlerank'
            },
            'war_rank': {
                signaturePic: 'tab_war_on.gif',
                CheckResultsFunction: 'checkResults_war_rank'
            },
            'achievements': {
                signaturePic: 'tab_achievements_on.gif',
                CheckResultsFunction: 'checkResults_achievements'
            },
            'battle': {
                signaturePic: 'battle_on.gif',
                CheckResultsFunction: 'checkResults_battle'
            },
            'soldiers': {
                signaturePic: 'tab_soldiers_on.gif',
                CheckResultsFunction: 'checkResults_soldiers'
            },
            'item': {
                signaturePic: 'tab_black_smith_on.gif',
                CheckResultsFunction: 'checkResults_item'
            },
            'magic': {
                signaturePic: 'tab_magic_on.gif',
                CheckResultsFunction: 'checkResults_magic'
            },
            'gift': {
                signaturePic: 'tab_gifts_on.gif',
                CheckResultsFunction: 'checkResults_gift'
            },
            'goblin_emp': {
                signaturePic: 'emporium_cancel.gif',
                CheckResultsFunction: 'checkResults_goblin_emp'
            },
            'view_class_progress': {
                signaturePic: 'nm_class_whole_progress_bar.jpg',
                CheckResultsFunction: 'checkResults_view_class_progress'
            },
            'guild': {
                signaturePic: 'tab_guild_main_on.gif',
                CheckResultsFunction: 'checkResults_guild'
            },
            'guild_current_battles': {
                signaturePic: 'tab_guild_current_battles_on.gif',
                CheckResultsFunction: 'checkResults_guild_current_battles'
            },
            'guild_current_monster_battles': {
                signaturePic: 'guild_monster_tab_on.jpg',
                CheckResultsFunction: 'checkResults_guild_current_monster_battles'
            },
            'guild_battle_monster': {
                signatureId: 'guild_battle_banner_section',
                CheckResultsFunction: 'checkResults_guild_battle_monster'
            },
            /*'arena': {
                signaturePic: 'tab_arena_on.gif',
                CheckResultsFunction: 'checkResults_arena'
            },
            'arena_battle': {
                signatureId: 'arena_battle_banner_section',
                CheckResultsFunction: 'checkResults_arena_battle'
            },*/
            'army_member': {
                signaturePic: 'view_army_on.gif',
                CheckResultsFunction: 'checkResults_army_member'
            },
            'festival_challenge': {
                signaturePic: 'festival_rankbarslider.gif',
                CheckResultsFunction: 'festivalBlessResults'
            },
            'festival_tower': {
                signaturePic: 'festival_monster_towerlist_button.jpg',
                CheckResultsFunction: 'checkResults_fightList'
            },
            'festival_battle_monster': {
                signaturePic: 'festival_achievement_monster_',
                CheckResultsFunction: 'checkResults_viewFight'
            },
            'festival_battle_home': {
                signaturePic: 'festival_button_rewards.gif',
                CheckResultsFunction: 'checkResults_festival_battle_home'
            },
            'festival_guild_battle': {
                signatureId: 'arena_battle_banner_section',
                CheckResultsFunction: 'checkResults_festival_guild_battle'
            },
            'army_news_feed': {
                signatureId: 'army_feed_body',
                CheckResultsFunction: 'checkResults_army_news_feed'
            },
            'party': {
                signaturePic: 'tab_elite_guard_on.gif',
                CheckResultsFunction: 'checkResults_party'
            }
        },

        addExpDisplay: function () {
            try {
                var catSTS = caap.caTools ? $j("#CA-Tools #alt_sts") : null,
                    catOK  = caap.caTools && catSTS && catSTS.css("display") !== 'none',
                    enlDiv = $j("#caap_enl", catOK ? catSTS : caap.globalContainer);

                enlDiv = $u.hasContent(enlDiv) ? enlDiv.html(caap.stats['exp']['dif']) : $j("#" + caap.domain.id[caap.domain.which] + "st_2_5 strong", catOK ? catSTS : caap.globalContainer).prepend("(<span id='caap_enl' style='color:red'>" + caap.stats['exp']['dif'] + "</span>) ");
                if (!$u.hasContent(enlDiv)) {
                    $u.warn("Unable to get experience array");
                }

                caap.setDivContent('exp_mess', "Experience to next level: " + caap.stats['exp']['dif']);
                return true;
            } catch (err) {
                $u.error("ERROR in addExpDisplay: " + err);
                return false;
            }
        },

        checkResults: function () {
            try {
                // Check page to see if we should go to a page specific check function
                // todo find a way to verify if a function exists, and replace the array with a check_functionName exists check
                if (!schedule.check('CheckResultsTimer')) {
                    return false;
                }

                schedule.setItem('CheckResultsTimer', 1);
                caap.appBodyDiv = $j("#" + caap.domain.id[caap.domain.which] + "app_body", caap.globalContainer);
                caap.resultsWrapperDiv = $j("#" + caap.domain.id[caap.domain.which] + "results_main_wrapper", caap.appBodyDiv);
                caap.resultsText = $u.setContent(caap.resultsWrapperDiv.text(), '').trim().innerTrim();
                caap.battlePage = caap.stats['level'] < 10 ? 'battle_train,battle_off' : 'battle';
                caap.pageLoadOK = caap.getStats();
                if (!caap.pageLoadOK) {
                    return true;
                }

                general.GetCurrent();
                if (general.quickSwitch) {
                    general.GetEquippedStats();
                }

                var pageUrl         = state.getItem('clickUrl', ''),
                    page            = $u.setContent(pageUrl, 'none').basename(".php"),
                    demiPointsFirst = config.getItem('DemiPointsFirst', false),
                    whenMonster     = config.getItem('WhenMonster', 'Never'),
                    it              = 0,
                    len             = 0;

                state.setItem('pageUserCheck', page === 'keep' ? $u.setContent(pageUrl.regex(/user=(\d+)/), 0) : 0);
                if ($u.hasContent(page) && $u.hasContent(caap.pageList[page]) && $u.hasContent(caap.pageList[page].subpages)) {
                    for (it = 0, len = caap.pageList[page].subpages.length; it < len; it += 1) {
                        if ($u.hasContent($j("img[src*='" + caap.pageList[caap.pageList[page].subpages[it]].signaturePic + "']", caap.appBodyDiv))) {
                            page = caap.pageList[page].subpages[it];
                            break;
                        }
                    }
                }

                state.setItem('page', page);
                if ($u.hasContent(caap.pageList[page])) {
                    $u.log(2, 'Checking results for', page);
                    if ($u.isFunction(caap[caap.pageList[page].CheckResultsFunction])) {
                        $u.log(3, 'Calling function', caap.pageList[page].CheckResultsFunction, caap.resultsText);
                        caap[caap.pageList[page].CheckResultsFunction]();
                    } else {
                        $u.warn('Check Results function not found', caap.pageList[page]);
                    }
                } else {
                    $u.log(2, 'No results check defined for', page);
                }

                // Information updates
                caap.updateDashboard();
                caap.addExpDisplay();
                caap.setDivContent('level_mess', 'Expected next level: ' + $u.makeTime(caap.stats['indicators']['enl'], schedule.timeStr(true)));
                caap.setDivContent('demipoint_mess', (demiPointsFirst && whenMonster !== 'Never') || config.getItem('WhenBattle', 'Never') === 'Demi Points Only' ? (state.getItem('DemiPointsDone', true) ? 'Daily Demi Points: Done' : (demiPointsFirst && whenMonster !== 'Never' ? 'Daily Demi Points: First' : 'Daily Demi Points: Only')) : '');
                caap.setDivContent('demibless_mess', schedule.check('BlessingTimer') ? 'Demi Blessing = none' : 'Next Demi Blessing: ' + $u.setContent(schedule.display('BlessingTimer'), "Unknown"));
                caap.setDivContent('feats_mess', schedule.check('festivalBlessTimer') ? 'Feat = none' : 'Next Feat: ' + $u.setContent(schedule.display('festivalBlessTimer'), "Unknown"));
                if ($u.hasContent(general.List) && general.List.length <= 2) {
                    schedule.setItem("generals", 0);
                    schedule.setItem("allGenerals", 0);
                    caap.checkGenerals();
                }

                return true;
            } catch (err) {
                $u.error("ERROR in checkResults: " + err);
                return false;
            }
        },

        checkResults_generals: function () {
            try {
                var currentGeneral = '',
                    html           = '',
                    time           = config.getItem("checkGenerals", 24);

                general.GetGenerals();
                currentGeneral = general.GetEquippedStats();
                if (currentGeneral) {
                    html = "<span title='Equipped Attack Power Index' style='font-size: 12px; font-weight: normal;'>EAPI:" + currentGeneral['eapi'] +
                           "</span> <span title='Equipped Defense Power Index' style='font-size: 12px; font-weight: normal;'>EDPI:" + currentGeneral['edpi'] +
                           "</span> <span title='Equipped Mean Power Index' style='font-size: 12px; font-weight: normal;'>EMPI:" + currentGeneral['empi'] + "</span>";
                    $j("#" + caap.domain.id[caap.domain.which] + "general_name_div_int", caap.appBodyDiv).append(html);
                }

                time = time < 24 ? 24 : time;
                schedule.setItem("generals", time * 3600, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_generals: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          GET STATS
        // Functions that records all of base game stats, energy, stamina, etc.
        /////////////////////////////////////////////////////////////////////

        // text in the format '123/234'
        getStatusNumbers: function (text) {
            try {
                text = $u.isString(text) ? text.trim() : '';
                if (text === '' || !$u.isString(text) || !/^\d+\/\d+$/.test(text)) {
                    throw "Invalid text supplied:" + text;
                }

                var num = $u.setContent(text.regex(/^(\d+)\//), 0),
                    max = $u.setContent(text.regex(/\/(\d+)$/), 0),
                    dif = $u.setContent(max - num, 0);

                return {
                    'num': num,
                    'max': max,
                    'dif': dif
                };
            } catch (err) {
                $u.error("ERROR in getStatusNumbers: " + err);
                return undefined;
            }
        },

        stats: {
            'FBID'       : 0,
            'account'    : '',
            'PlayerName' : '',
            'level'      : 0,
            'army'       : {
                'actual' : 0,
                'capped' : 0
            },
            'generals'   : {
                'total'  : 0,
                'invade' : 0
            },
            'attack'     : 0,
            'defense'    : 0,
            'points'     : {
                'skill' : 0,
                'favor' : 0
            },
            'indicators' : {
                'bsi'  : 0,
                'lsi'  : 0,
                'sppl' : 0,
                'api'  : 0,
                'dpi'  : 0,
                'mpi'  : 0,
                'htl'  : 0,
                'hrtl' : 0,
                'enl'  : 0
            },
            'gold' : {
                'cash'    : 0,
                'bank'    : 0,
                'total'   : 0,
                'income'  : 0,
                'upkeep'  : 0,
                'flow'    : 0,
                'ticker'  : []
            },
            'rank' : {
                'battle'       : 0,
                'battlePoints' : 0,
                'war'          : 0,
                'warPoints'    : 0
            },
            'potions' : {
                'energy'  : 0,
                'stamina' : 0
            },
            'energy' : {
                'num' : 0,
                'max' : 0,
                'dif' : 0
            },
            'energyT' : {
                'num' : 0,
                'max' : 0,
                'dif' : 0
            },
            'health' : {
                'num' : 0,
                'max' : 0,
                'dif' : 0
            },
            'healthT' : {
                'num' : 0,
                'max' : 0,
                'dif' : 0
            },
            'stamina' : {
                'num' : 0,
                'max' : 0,
                'dif' : 0
            },
            'staminaT' : {
                'num' : 0,
                'max' : 0,
                'dif' : 0
            },
            'exp' : {
                'num' : 0,
                'max' : 0,
                'dif' : 0
            },
            'other' : {
                'qc'       : 0,
                'bww'      : 0,
                'bwl'      : 0,
                'te'       : 0,
                'tee'      : 0,
                'wlr'      : 0,
                'eer'      : 0,
                'atlantis' : false
            },
            'achievements' : {
                'battle' : {
                    'invasions' : {
                        'won'    : 0,
                        'lost'   : 0,
                        'streak' : 0,
                        'ratio'  : 0
                    },
                    'duels' : {
                        'won'    : 0,
                        'lost'   : 0,
                        'streak' : 0,
                        'ratio'  : 0
                    }
                },
                'monster' : {},
                'other' : {
                    'alchemy' : 0
                }
            },
            'character' : {},
            'guild' : {
                'name'    : '',
                'id'      : '',
                'mPoints' : 0,
                'mRank'   : '',
                'bPoints' : 0,
                'bRank'   : '',
                'members' : []
            }
        },


        loadStats: function (FBID, AccName) {
            var Stats = gm.getItem('stats.record', 'default');
            if (Stats === 'default' || !$j.isPlainObject(Stats)) {
                Stats = gm.setItem('stats.record', caap.stats);
            }

            $j.extend(true, caap.stats, Stats);
            caap.stats['FBID'] = FBID;
            caap.stats['account'] = AccName;
            $u.log(4, "Stats", caap.stats);
            state.setItem("UserDashUpdate", true);
        },
        /*jslint sub: false */

        saveStats: function () {
            gm.setItem('stats.record', caap.stats);
            $u.log(4, "Stats", caap.stats);
            state.setItem("UserDashUpdate", true);
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        getStats: function () {
            try {
                var passed      = true,
                    tNum        = 0,
                    xS          = 0,
                    xE          = 0,
                    ststbDiv    = $j("#" + caap.domain.id[caap.domain.which] + "main_ststb", caap.globalContainer),
                    bntpDiv     = $j("#" + caap.domain.id[caap.domain.which] + "main_bntp", caap.globalContainer),
                    tempDiv     = $j("#" + caap.domain.id[caap.domain.which] + "gold_current_value", ststbDiv);

                // gold
                if ($u.hasContent(tempDiv)) {
                    caap.stats['gold']['cash'] = $u.setContent($u.setContent(tempDiv.text(), '').numberOnly(), 0);
                    caap.stats['gold']['total'] = caap.stats['gold']['bank'] + caap.stats['gold']['cash'];
                } else {
                    $u.warn("Unable to get cashDiv");
                    passed = false;
                }

                // energy
                tempDiv = $j("#" + caap.domain.id[caap.domain.which] + "st_2_2", ststbDiv);
                if ($u.hasContent(tempDiv)) {
                    caap.stats['energyT'] = caap.getStatusNumbers($u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+\/\d+)/), "0/0"));
                    caap.stats['energy'] = caap.getStatusNumbers(caap.stats['energyT']['num'] + "/" + caap.stats['energy']['max']);
                } else {
                    $u.warn("Unable to get energyDiv");
                    passed = false;
                }

                // health
                tempDiv = $j("#" + caap.domain.id[caap.domain.which] + "st_2_3", ststbDiv);
                if ($u.hasContent(tempDiv)) {
                    caap.stats['healthT'] = caap.getStatusNumbers($u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+\/\d+)/), "0/0"));
                    caap.stats['health'] = caap.getStatusNumbers(caap.stats['healthT']['num'] + "/" + caap.stats['health']['max']);
                } else {
                    $u.warn("Unable to get healthDiv");
                    passed = false;
                }

                // stamina
                tempDiv = $j("#" + caap.domain.id[caap.domain.which] + "st_2_4", ststbDiv);
                if ($u.hasContent(tempDiv)) {
                    caap.stats['staminaT'] = caap.getStatusNumbers($u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+\/\d+)/), "0/0"));
                    caap.stats['stamina'] = caap.getStatusNumbers(caap.stats['staminaT']['num'] + "/" + caap.stats['stamina']['max']);
                } else {
                    $u.warn("Unable to get staminaDiv");
                    passed = false;
                }

                // experience
                tempDiv = $j("#" + caap.domain.id[caap.domain.which] + "st_2_5", ststbDiv);
                if ($u.hasContent(tempDiv)) {
                    caap.stats['exp'] = caap.getStatusNumbers($u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+\/\d+)/), "0/0"));
                } else {
                    $u.warn("Unable to get expDiv");
                    passed = false;
                }

                // level
                tempDiv = $j("#" + caap.domain.id[caap.domain.which] + "st_5", ststbDiv);
                if ($u.hasContent(tempDiv)) {
                    tNum = $u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+)/), 0);
                    if (tNum > caap.stats['level']) {
                        $u.log(2, 'New level. Resetting Best Land Cost.');
                        caap.bestLand = state.setItem('BestLandCost', new caap.landRecord().data);
                        state.setItem('KeepLevelUpGeneral', true);
                    }

                    caap.stats['level'] = tNum;
                } else {
                    $u.warn("Unable to get levelDiv");
                    passed = false;
                }

                // army
                tempDiv = $j("a[href*='army.php']", bntpDiv);
                if ($u.hasContent(tempDiv)) {
                    caap.stats['army']['actual'] = $u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+)/), 0);
                    tNum = Math.min(caap.stats['army']['actual'], 501);
                    if (tNum >= 1 && tNum <= 501) {
                        caap.stats['army']['capped'] = tNum;
                    } else {
                        $u.warn("Army count not in limits");
                        passed = false;
                    }
                } else {
                    $u.warn("Unable to get armyDiv");
                    passed = false;
                }

                // upgrade points
                tempDiv = $j("a[href*='keep.php']", bntpDiv);
                if ($u.hasContent(tempDiv)) {
                    tNum = $u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+)/), 0);
                    if (tNum > caap.stats['points']['skill']) {
                        $u.log(2, 'New points. Resetting AutoStat.');
                        state.setItem("statsMatch", true);
                    }

                    caap.stats['points']['skill'] = tNum;
                } else {
                    $u.warn("Unable to get pointsDiv");
                    passed = false;
                }

                // Indicators: Hours To Level, Time Remaining To Level and Expected Next Level
                if (caap.stats['exp']) {
                    xS = gm.getItem("expStaminaRatio", 2.4, hiddenVar);
                    xE = state.getItem('AutoQuest', caap.newAutoQuest())['expRatio'] || gm.getItem("expEnergyRatio", 1.4, hiddenVar);
                    caap.stats['indicators']['htl'] = ((caap.stats['level'] * 12.5) - (caap.stats['stamina']['max'] * xS) - (caap.stats['energy']['max'] * xE)) / (12 * (xS + xE));
                    caap.stats['indicators']['hrtl'] = (caap.stats['exp']['dif'] - (caap.stats['stamina']['num'] * xS) - (caap.stats['energy']['num'] * xE)) / (12 * (xS + xE));
                    caap.stats['indicators']['enl'] = new Date().getTime() + Math.ceil(caap.stats['indicators']['hrtl'] * 3600000);
                } else {
                    $u.warn('Could not calculate time to next level. Missing experience stats!');
                    passed = false;
                }

                if (!passed)  {
                    caap.saveStats();
                }

                if (!passed && caap.stats['energy']['max'] === 0 && caap.stats['health']['max'] === 0 && caap.stats['stamina']['max'] === 0) {
                    $j().alert("<div style='text-align: center;'>" + $u.warn("Paused as this account may have been disabled!", caap.stats) + "</div>");
                    caap.pauseListener();
                }

                return passed;
            } catch (err) {
                $u.error("ERROR getStats: " + err);
                return false;
            }
        },

        checkResults_keep: function () {
            try {
                var attrDiv    = $j(".keep_attribute_section", caap.appBodyDiv),
                    statsTB    = $j(".statsTB", caap.appBodyDiv),
                    keepTable1 = $j(".keepTable1 tr", statsTB),
                    statCont   = $j(".attribute_stat_container", attrDiv),
                    tempDiv    = $j();

                if ($u.hasContent(attrDiv)) {
                    $u.log(8, "Getting new values from player keep");
                    // rank
                    tempDiv = $j("img[src*='gif/rank']", caap.appBodyDiv);
                    if ($u.hasContent(tempDiv)) {
                        caap.stats['rank']['battle'] = $u.setContent($u.setContent(tempDiv.attr("src"), '').basename().regex(/(\d+)/), 0);
                    } else {
                        $u.warn('Using stored rank.');
                    }

                    // PlayerName
                    tempDiv = $j(".keep_stat_title_inc", attrDiv);
                    if ($u.hasContent(tempDiv)) {
                        caap.stats['PlayerName'] = $u.setContent($u.setContent(tempDiv.text(), '').regex(new RegExp("\"(.+)\",")), '');
                    } else {
                        $u.warn('Using stored PlayerName.');
                    }

                    // war rank
                    if (caap.stats['level'] >= 100) {
                        tempDiv = $j("img[src*='war_rank_']", caap.appBodyDiv);
                        if ($u.hasContent(tempDiv)) {
                            caap.stats['rank']['war'] = $u.setContent($u.setContent(tempDiv.attr("src"), '').basename().regex(/(\d+)/), 0);
                        } else {
                            $u.warn('Using stored warRank.');
                        }
                    }

                    if ($u.hasContent(statCont) && statCont.length === 6) {
                        // Energy
                        tempDiv = statCont.eq(0);
                        if ($u.hasContent(tempDiv)) {
                            caap.stats['energy'] = caap.getStatusNumbers(caap.stats['energyT']['num'] + '/' + $u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+)/), 0));
                        } else {
                            $u.warn('Using stored energy value.');
                        }

                        // Stamina
                        tempDiv = statCont.eq(1);
                        if ($u.hasContent(tempDiv)) {
                            caap.stats['stamina'] = caap.getStatusNumbers(caap.stats['staminaT']['num'] + '/' + $u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+)/), 0));
                        } else {
                            $u.warn('Using stored stamina value.');
                        }

                        if (caap.stats['level'] >= 10) {
                            // Attack
                            tempDiv = statCont.eq(2);
                            if ($u.hasContent(tempDiv)) {
                                caap.stats['attack'] = $u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+)/), 0);
                            } else {
                                $u.warn('Using stored attack value.');
                            }

                            // Defense
                            tempDiv = statCont.eq(3);
                            if ($u.hasContent(tempDiv)) {
                                caap.stats['defense'] = $u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+)/), 0);
                            } else {
                                $u.warn('Using stored defense value.');
                            }
                        }

                        // Health
                        tempDiv = statCont.eq(4);
                        if ($u.hasContent(tempDiv)) {
                            caap.stats['health'] = caap.getStatusNumbers(caap.stats['healthT']['num'] + '/' + $u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+)/), 0));
                        } else {
                            $u.warn('Using stored health value.');
                        }
                    } else {
                        $u.warn("Can't find stats containers! Using stored stats values.");
                    }

                    // Check for Gold Stored
                    tempDiv = $j(".money", statsTB);
                    if ($u.hasContent(tempDiv)) {
                        caap.stats['gold']['bank'] = $u.setContent($u.setContent(tempDiv.text(), '').numberOnly(), 0);
                        caap.stats['gold']['total'] = caap.stats['gold']['bank'] + caap.stats['gold']['cash'];
                        tempDiv.attr({
                            title : "Click to copy value to retrieve",
                            style : "color: blue;"
                        }).hover(
                            function () {
                                caap.style.cursor = 'pointer';
                            },
                            function () {
                                caap.style.cursor = 'default';
                            }
                        ).click(function () {
                            $j("input[name='get_gold']", caap.appBodyDiv).val(caap.stats['gold']['bank']);
                        });
                    } else {
                        $u.warn('Using stored inStore.');
                    }

                    // Check for income
                    tempDiv = $j(".positive", statsTB).eq(0);
                    if ($u.hasContent(tempDiv)) {
                        caap.stats['gold']['income'] = $u.setContent($u.setContent(tempDiv.text(), '').numberOnly(), 0);
                    } else {
                        $u.warn('Using stored income.');
                    }

                    // Check for upkeep
                    tempDiv = $j(".negative", statsTB);
                    if ($u.hasContent(tempDiv)) {
                        caap.stats['gold']['upkeep'] = $u.setContent($u.setContent(tempDiv.text(), '').numberOnly(), 0);
                    } else {
                        $u.warn('Using stored upkeep.');
                    }

                    // Cash Flow
                    caap.stats['gold']['flow'] = caap.stats['gold']['income'] - caap.stats['gold']['upkeep'];

                    // Energy potions
                    tempDiv = $j("img[title='Energy Potion']", caap.appBodyDiv).parent().next();
                    if ($u.hasContent(tempDiv)) {
                        caap.stats['potions']['energy'] = $u.setContent($u.setContent(tempDiv.text(), '').numberOnly(), 0);
                    } else {
                        caap.stats['potions']['energy'] = 0;
                    }

                    // Stamina potions
                    tempDiv = $j("img[title='Stamina Potion']", caap.appBodyDiv).parent().next();
                    if ($u.hasContent(tempDiv)) {
                        caap.stats['potions']['stamina'] = $u.setContent($u.setContent(tempDiv.text(), '').numberOnly(), 0);
                    } else {
                        caap.stats['potions']['stamina'] = 0;
                    }

                    // Other stats
                    // Atlantis Open
                    caap.stats['other'].atlantis = $u.hasContent(caap.checkForImage("seamonster_map_finished.jpg")) ? true : false;

                    // quests Completed
                    tempDiv = $j("td:last", keepTable1.eq(0));
                    if ($u.hasContent(tempDiv)) {
                        caap.stats['other']['qc'] = $u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+)/), 0);
                    } else {
                        $u.warn('Using stored other.');
                    }

                    // Battles/Wars Won
                    tempDiv = $j("td:last", keepTable1.eq(1));
                    if ($u.hasContent(tempDiv)) {
                        caap.stats['other']['bww'] = $u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+)/), 0);
                    } else {
                        $u.warn('Using stored other.');
                    }

                    // Battles/Wars Lost
                    tempDiv = $j("td:last", keepTable1.eq(2));
                    if ($u.hasContent(tempDiv)) {
                        caap.stats['other']['bwl'] = $u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+)/), 0);
                    } else {
                        $u.warn('Using stored other.');
                    }

                    // Times eliminated
                    tempDiv = $j("td:last", keepTable1.eq(3));
                    if ($u.hasContent(tempDiv)) {
                        caap.stats['other']['te'] = $u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+)/), 0);
                    } else {
                        $u.warn('Using stored other.');
                    }

                    // Times you eliminated an enemy
                    tempDiv = $j("td:last", keepTable1.eq(4));
                    if ($u.hasContent(tempDiv)) {
                        caap.stats['other']['tee'] = $u.setContent($u.setContent(tempDiv.text(), '').regex(/(\d+)/), 0);
                    } else {
                        $u.warn('Using stored other.');
                    }

                    // Win/Loss Ratio (WLR)
                    caap.stats['other']['wlr'] = caap.stats['other']['bwl'] !== 0 ? (caap.stats['other']['bww'] / caap.stats['other']['bwl']).dp(2) : Infinity;
                    // Enemy Eliminated Ratio/Eliminated (EER)
                    caap.stats['other']['eer'] = caap.stats['other']['tee'] !== 0 ? (caap.stats['other']['tee'] / caap.stats['other']['te']).dp(2) : Infinity;
                    // Indicators
                    if (caap.stats['level'] >= 10) {
                        caap.stats['indicators']['bsi'] = ((caap.stats['attack'] + caap.stats['defense']) / caap.stats['level']).dp(2);
                        caap.stats['indicators']['lsi'] = ((caap.stats['energy']['max'] + (2 * caap.stats['stamina']['max'])) / caap.stats['level']).dp(2);
                        caap.stats['indicators']['sppl'] = ((caap.stats['energy']['max'] + (2 * caap.stats['stamina']['max']) + caap.stats['attack'] + caap.stats['defense'] + caap.stats['health']['max'] - 122) / caap.stats['level']).dp(2);
                        caap.stats['indicators']['api'] = ((caap.stats['attack'] + (caap.stats['defense'] * 0.7))).dp(2);
                        caap.stats['indicators']['dpi'] = ((caap.stats['defense'] + (caap.stats['attack'] * 0.7))).dp(2);
                        caap.stats['indicators']['mpi'] = (((caap.stats['indicators']['api'] + caap.stats['indicators']['dpi']) / 2)).dp(2);
                    }

                    schedule.setItem("keep", gm.getItem("checkKeep", 1, hiddenVar) * 3600, 300);
                    caap.saveStats();
                    tempDiv = $j(".keep_stat_title_inc", attrDiv);
                    tempDiv = $u.hasContent(tempDiv) ? tempDiv.html($u.setContent(tempDiv.html(), '').trim() + ", <span style='white-space: nowrap;'>BSI: " + caap.stats['indicators']['bsi'] + " LSI: " + caap.stats['indicators']['lsi'] + "</span>") : tempDiv;
                } else {
                    tempDiv = $j("a[href*='keep.php?user=']", caap.appBodyDiv);
                    if ($u.hasContent(tempDiv)) {
                        $u.log(2, "On another player's keep", $u.setContent($u.setContent(tempDiv.attr("href"), '').basename().regex(/(\d+)/), 0));
                    } else {
                        $u.warn("Attribute section not found and not identified as another player's keep!");
                    }
                }

                if (config.getItem("enableTitles", true)) {
                    spreadsheet.doTitles();
                }

                if (config.getItem("enableKeepShrink", true)) {
                    $j("div[class*='statUnit'] img", caap.appBodyDiv).attr("style", "height: 45px; width: 45px;").not("div[class*='statUnit'] img[alt='Stamina Potion'],img[alt='Energy Potion']", caap.appBodyDiv).parent().parent().attr("style", "height: 45px; width: 45px;");
                }

                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_keep: " + err);
                return false;
            }
        },

        checkResults_oracle: function () {
            try {
                var favorDiv = $j(".title_action", caap.appBodyDiv),
                    text     = '',
                    tNum     = 0,
                    save     = false;

                if ($u.setContent(favorDiv)) {
                    text = favorDiv.text();
                    if (/You have zero favor points!/.test(text)) {
                        caap.stats['points']['favor'] = 0;
                        save = true;
                    } else if (/You have a favor point!/.test(text)) {
                        caap.stats['points']['favor'] = 1;
                        save = true;
                    } else {
                        tNum = text.regex(/You have (\d+) favor points!/);
                        if ($u.hasContent(tNum)) {
                            caap.stats['points']['favor'] = tNum;
                            save = true;
                        }
                    }
                } else {
                    $u.warn('Favor Points div not found.');
                }

                if (save) {
                    $u.log(2, 'Got number of Favor Points', caap.stats['points']['favor']);
                    caap.saveStats();
                } else {
                    $u.warn('Favor Points not matched.');
                }

                schedule.setItem("oracle", gm.getItem("checkOracle", 24, hiddenVar) * 3600, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_oracle: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        checkResults_alchemy: function () {
            try {
                if (config.getItem("enableTitles", true)) {
                    spreadsheet.doTitles();
                }

                var recipeDiv   = $j(".alchemyRecipeBack .recipeTitle", caap.appBodyDiv),
                    titleTxt    = '',
                    titleRegExp = new RegExp("RECIPES: Create (.+)", "i"),
                    image       = '',
                    hideCount   = config.getItem("recipeCleanCount", 1),
                    special     = [
                        "Volcanic Knight",
                        "Holy Plate",
                        "Atlantean Forcefield",
                        "Spartan Phalanx",
                        "Cronus, The World Hydra",
                        "Helm of Dragon Power",
                        "Avenger",
                        "Judgement",
                        "Tempered Steel",
                        "Bahamut, the Volcanic Dragon",
                        "Blood Zealot",
                        "Transcendence",
                        "Soul Crusher",
                        "Soulforge",
                        "Crown of Flames"
                    ];

                hideCount = hideCount < 1 ? 1 : hideCount;
                if ($u.hasContent(recipeDiv)) {
                    recipeDiv.each(function () {
                        var row = $j(this);
                        titleTxt = row.text().trim().innerTrim().regex(titleRegExp);
                        if ($u.hasContent(titleTxt)) {
                            if (titleTxt === "Elven Crown") {
                                image = "gift_aeris_complete.jpg";
                            }

                            if (spreadsheet.isSummon(titleTxt, image)) {
                                row.text(row.text().trim() + ' : Summon Owned (' + town.getCount(titleTxt, image) + ')') ;
                            } else {
                                row.text(row.text().trim() + ' : Owned (' + town.getCount(titleTxt, image) + ')') ;
                                if (config.getItem("enableRecipeClean", true) && !special.hasIndexOf(titleTxt) && town.getCount(titleTxt, image) >= hideCount) {
                                    row.parent().parent().css("display", "none").next().css("display", "none");
                                }
                            }
                        }

                        return true;
                    });
                }

                if (config.getItem("enableIngredientsHide", false)) {
                    $j("div[class='statsTTitle'],div[class='statsTMain']", caap.appBodyDiv).css("display", "none");
                }

                if (config.getItem("enableAlchemyShrink", true)) {
                    $j("div[class*='alchemyRecipeBack'],div[class*='alchemyQuestBack']", caap.appBodyDiv).css("height", "100px");
                    $j("div[class*='alchemySpace']", caap.appBodyDiv).css("height", "4px");
                    $j(".statsT2 img").not("img[src*='emporium_go.gif']", caap.appBodyDiv).attr("style", "height: 45px; width: 45px;").parent().attr("style", "height: 45px; width: 45px;").parent().css("width", "50px");
                    $j("input[name='Alchemy Submit']", caap.appBodyDiv).css("width", "80px");
                    $j(".recipeTitle", caap.appBodyDiv).css("margin", "0px");
                }

                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_alchemy: " + err);
                return false;
            }
        },

        commonTown: function () {
            try {
                $j("form[id*='itemBuy'] select[name='amount']", caap.appBodyDiv).val("5");
                if (config.getItem("enableTitles", true)) {
                    spreadsheet.doTitles();
                }

                return true;
            } catch (err) {
                $u.error("ERROR in commonTown: " + err);
                return false;
            }
        },

        checkResults_soldiers: function () {
            try {
                caap.commonTown();
                town.GetItems("soldiers");
                var time = config.getItem("checkSoldiers", 72);
                time = time < 72 ? 72 : time;
                schedule.setItem("soldiers", time * 3600, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_soldiers: " + err);
                return false;
            }
        },

        checkResults_item: function () {
            try {
                caap.commonTown();
                town.GetItems("item");
                var time = config.getItem("checkItem", 72);
                time = time < 72 ? 72 : time;
                schedule.setItem("item", time * 3600, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_item: " + err);
                return false;
            }
        },

        checkResults_magic: function () {
            try {
                caap.commonTown();
                town.GetItems("magic");
                var time = config.getItem("checkMagic", 72);
                time = time < 72 ? 72 : time;
                schedule.setItem("magic", time * 3600, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_magic: " + err);
                return false;
            }
        },

        checkResults_goblin_emp: function () {
            try {
                if (config.getItem("goblinHinting", true)) {
                    spreadsheet.doTitles(true);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_goblin_emp: " + err);
                return false;
            }
        },

        checkResults_gift: function () {
            try {
                var time = config.getItem("checkGift", 3);
                time = time < 3 ? 3 : time;
                gifting.gifts.populate();
                schedule.setItem("gift", time * 86400, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_gift: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checkResults_battlerank: function () {
            try {
                var rankDiv = $j("div[style*='battle_rank_banner.jpg']", caap.appBodyDiv),
                    tNum    = 0;

                if ($u.hasContent(rankDiv)) {
                    tNum = $u.setContent($u.setContent(rankDiv.text(), '').replace(',', '').regex(/with (\d+) Battle Points/i), 0);
                    if ($u.hasContent(tNum)) {
                        $u.log(2, 'Got Battle Rank Points', tNum);
                        caap.stats['rank']['battlePoints'] = tNum;
                        caap.saveStats();
                    } else {
                        $u.warn('Battle Rank Points RegExp not matched.');
                    }
                } else {
                    $u.warn('Battle Rank Points div not found.');
                }

                schedule.setItem("battlerank", gm.getItem("checkBattleRank", 48, hiddenVar) * 3600, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_battlerank: " + err);
                return false;
            }
        },

        checkResults_war_rank: function () {
            try {
                var rankDiv = $j("div[style*='war_rank_banner.jpg']", caap.appBodyDiv),
                    tNum    = 0;

                if ($u.hasContent(rankDiv)) {
                    tNum = $u.setContent($u.setContent(rankDiv.text(), '').replace(',', '').regex(/with (\d+) War Points/i), 0);
                    if ($u.hasContent(tNum)) {
                        $u.log(2, 'Got War Rank Points', tNum);
                        caap.stats['rank']['warPoints'] = tNum;
                        caap.saveStats();
                    } else {
                        $u.warn('War Rank Points RegExp not matched.');
                    }
                } else {
                    $u.warn('War Rank Points div not found.');
                }

                schedule.setItem("warrank", gm.getItem("checkWarRank", 48, hiddenVar) * 3600, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_war_rank: " + err);
                return false;
            }
        },

        checkResults_achievements: function () {
            try {
                var achDiv = $j("#" + caap.domain.id[caap.domain.which] + "achievements_2", caap.appBodyDiv),
                    tdDiv  = $j("td div", achDiv);

                if ($u.hasContent(achDiv)) {
                    if ($u.hasContent(tdDiv) && tdDiv.length === 6) {
                        caap.stats['achievements']['battle']['invasions']['won'] = $u.setContent(tdDiv.eq(0).text().numberOnly(), 0);
                        caap.stats['achievements']['battle']['duels']['won'] = $u.setContent(tdDiv.eq(1).text().numberOnly(), 0);
                        caap.stats['achievements']['battle']['invasions']['lost'] = $u.setContent(tdDiv.eq(2).text().numberOnly(), 0);
                        caap.stats['achievements']['battle']['duels']['lost'] = $u.setContent(tdDiv.eq(3).text().numberOnly(), 0);
                        caap.stats['achievements']['battle']['invasions']['streak'] = $u.setContent(tdDiv.eq(4).text().numberOnly(), 0);
                        caap.stats['achievements']['battle']['duels']['streak'] = $u.setContent(tdDiv.eq(5).text().numberOnly(), 0);
                        caap.stats['achievements']['battle']['invasions']['ratio'] = caap.stats['achievements']['battle']['invasions']['lost'] > 0 ? (caap.stats['achievements']['battle']['invasions']['won'] / caap.stats['achievements']['battle']['invasions']['lost']).dp(2) : Infinity;
                        caap.stats['achievements']['battle']['duels']['ratio'] = caap.stats['achievements']['battle']['invasions']['lost'] > 0 ? (caap.stats['achievements']['battle']['duels']['won'] / caap.stats['achievements']['battle']['duels']['lost']).dp(2) : Infinity;
                        caap.saveStats();
                    } else {
                        $u.warn('Battle Achievements problem.');
                    }
                } else {
                    $u.warn('Battle Achievements not found.');
                }

                achDiv = $j("#" + caap.domain.id[caap.domain.which] + "achievements_3", caap.appBodyDiv);
                if ($u.hasContent(achDiv)) {
                    tdDiv = $j("td", achDiv);
                    if ($u.hasContent(tdDiv)) {
                        caap.stats['achievements']['monster'] = {};
                        tdDiv.each(function () {
                            var td  = $j(this),
                                divNum = $j("div", td).text().parseInt(),
                                tdTxt = td.justtext().trim();

                            caap.stats['achievements']['monster'][tdTxt] = divNum;
                        });

                        caap.saveStats();
                    } else {
                        $u.warn('Monster Achievements problem.');
                    }
                } else {
                    $u.warn('Monster Achievements not found.');
                }

                achDiv = $j("#" + caap.domain.id[caap.domain.which] + "achievements_4", caap.appBodyDiv);
                if ($u.hasContent(achDiv)) {
                    tdDiv = $j("td div", achDiv);
                    if ($u.hasContent(tdDiv) && tdDiv.length === 1) {
                        caap.stats['achievements']['other']['alchemy'] = $u.setContent(tdDiv.eq(0).text().numberOnly(), 0);
                        caap.saveStats();
                    } else {
                        $u.warn('Other Achievements problem.');
                    }
                } else {
                    $u.warn('Other Achievements not found.');
                }

                schedule.setItem("achievements", gm.getItem("checkAchievements", 72, hiddenVar) * 3600, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_achievements: " + err);
                return false;
            }
        },

        checkResults_view_class_progress: function () {
            try {
                var classDiv = $j("#" + caap.domain.id[caap.domain.which] + "choose_class_screen div[class*='banner_']", caap.appBodyDiv);
                if ($u.hasContent(classDiv)) {
                    caap.stats['character'] = {};
                    classDiv.each(function () {
                        var monsterClass = $j(this),
                            name         = $u.setContent(monsterClass.attr("class"), '').replace("banner_", '').ucFirst();

                        if (name) {
                            caap.stats['character'][name] = {};
                            caap.stats['character'][name]['percent'] = $u.setContent($j("img[src*='progress']", monsterClass).eq(0).getPercent('width').dp(2), 0);
                            caap.stats['character'][name]['level'] = $u.setContent(monsterClass.children().eq(2).text().numberOnly(), 0);
                            $u.log(2, "Got character class record", name, caap.stats['character'][name]);
                            caap.saveStats();
                        } else {
                            $u.warn("Problem character class name", name);
                        }
                    });
                } else {
                    $u.warn("Problem with character class records", classDiv);
                }

                schedule.setItem("view_class_progress", gm.getItem("CheckClassProgress", 48, hiddenVar) * 3600, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_view_class_progress: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          QUESTING
        // Quest function does action, DrawQuest sets up the page and gathers info
        /////////////////////////////////////////////////////////////////////

        maxEnergyQuest: function () {
            try {
                var maxIdleEnergy = 0,
                    theGeneral    = config.getItem('IdleGeneral', 'Use Current');

                if (theGeneral !== 'Use Current') {
                    maxIdleEnergy = $u.setContent(general.GetEnergyMax(theGeneral), 0);
                    if (maxIdleEnergy <= 0 || $u.isNaN(maxIdleEnergy)) {
                        $u.log(1, "Changing to idle general to get Max energy");
                        if (general.Select('IdleGeneral')) {
                            return true;
                        }
                    }
                }

                return caap.stats['energy']['num'] >= maxIdleEnergy ? caap.quests() : false;
            } catch (err) {
                $u.error("ERROR in maxEnergyQuest: " + err);
                return undefined;
            }
        },
        /*jslint sub: false */

        questAreaInfo: {
            'Land of Fire' : {
                clas : 'quests_stage_1',
                base : 'land_fire',
                next : 'Land of Earth',
                area : '',
                list : '',
                boss : 'Heart of Fire',
                orb  : 'Orb of Gildamesh'
            },
            'Land of Earth' : {
                clas : 'quests_stage_2',
                base : 'land_earth',
                next : 'Land of Mist',
                area : '',
                list : '',
                boss : 'Gift of Earth',
                orb  : 'Colossal Orb'
            },
            'Land of Mist' : {
                clas : 'quests_stage_3',
                base : 'land_mist',
                next : 'Land of Water',
                area : '',
                list : '',
                boss : 'Eye of the Storm',
                orb  : 'Sylvanas Orb'
            },
            'Land of Water' : {
                clas : 'quests_stage_4',
                base : 'land_water',
                next : 'Demon Realm',
                area : '',
                list : '',
                boss : 'A Look into the Darkness',
                orb  : 'Orb of Mephistopheles'
            },
            'Demon Realm' : {
                clas : 'quests_stage_5',
                base : 'land_demon_realm',
                next : 'Undead Realm',
                area : '',
                list : '',
                boss : 'The Rift',
                orb  : 'Orb of Keira'
            },
            'Undead Realm' : {
                clas : 'quests_stage_6',
                base : 'land_undead_realm',
                next : 'Underworld',
                area : '',
                list : '',
                boss : 'Undead Embrace',
                orb  : 'Lotus Orb'
            },
            'Underworld' : {
                clas : 'quests_stage_7',
                base : 'tab_underworld',
                next : 'Kingdom of Heaven',
                area : '',
                list : '',
                boss : 'Confrontation',
                orb  : 'Orb of Skaar Deathrune'
            },
            'Kingdom of Heaven' : {
                clas : 'quests_stage_8',
                base : 'tab_heaven',
                next : 'Ivory City',
                area : '',
                list : '',
                boss : 'Archangels Wrath',
                orb  : 'Orb of Azriel'
            },
            'Ivory City' : {
                clas : 'quests_stage_9',
                base : 'tab_ivory',
                next : 'Earth II',
                area : '',
                list : '',
                boss : 'Entrance to the Throne',
                orb  : 'Orb of Alpha Mephistopheles'
            },
            'Earth II' : {
                clas : 'quests_stage_10',
                base : 'tab_earth2',
                next : 'Water II',
                area : '',
                list : '',
                boss : "Lion's Rebellion",
                orb  : 'Orb of Aurelius'
            },
            'Water II' : {
                clas : 'quests_stage_11',
                base : 'tab_water2',
                next : 'Mist II',
                area : '',
                list : '',
                boss : "Corvintheus",
                orb  : 'Orb of Corvintheus'
            },
            'Mist II' : {
                clas : 'quests_stage_12',
                base : 'tab_mist2',
                next : 'Mist III',
                area : '',
                list : '',
                boss : "Jahanna",
                orb  : 'Orb of Jahanna'
            },
            'Mist III' : {
                clas : 'quests_stage_13',
                base : 'tab_mist3',
                next : 'DemiChange',
                area : '',
                list : '',
                boss : "Aurora",
                orb  : 'Orb of Aurora'
            },
            'DemiChange' : {
                clas : 'symbolquests_stage_1',
                next : 'Ambrosia',
                area : 'Demi Quests',
                list : 'demiQuestList'
            },
            'Ambrosia' : {
                clas : 'symbolquests_stage_1',
                next : 'Malekus',
                area : '',
                list : ''
            },
            'Malekus' : {
                clas : 'symbolquests_stage_2',
                next : 'Corvintheus',
                area : '',
                list : ''
            },
            'Corvintheus' : {
                clas : 'symbolquests_stage_3',
                next : 'Aurora',
                area : '',
                list : ''
            },
            'Aurora' : {
                clas : 'symbolquests_stage_4',
                next : 'Azeron',
                area : '',
                list : ''
            },
            'Azeron' : {
                clas : 'symbolquests_stage_5',
                next : 'AtlantisChange',
                area : '',
                list : ''
            },
            'AtlantisChange' : {
                clas : 'monster_quests_stage_1',
                next : 'Atlantis',
                area : 'Atlantis',
                list : 'atlantisQuestList'
            },
            'Atlantis' : {
                clas : 'monster_quests_stage_1',
                next : '',
                area : '',
                list : ''
            }
        },

        demiQuestTable : {
            'Ambrosia'    : 'energy',
            'Malekus'     : 'attack',
            'Corvintheus' : 'defense',
            'Aurora'      : 'health',
            'Azeron'      : 'stamina'
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        quests: function () {
            try {
                var storeRetrieve = state.getItem('storeRetrieve', '');
                if (storeRetrieve) {
                    if (storeRetrieve === 'general') {
                        $u.log(1, "storeRetrieve", storeRetrieve);
                        if (general.Select('BuyGeneral')) {
                            return true;
                        }

                        state.setItem('storeRetrieve', '');
                        return true;
                    } else {
                        return caap.retrieveFromBank(storeRetrieve);
                    }
                }

                caap.setDivContent('quest_mess', '');
                var whenQuest = config.getItem('WhenQuest', 'Never');
                if (whenQuest === 'Never') {
                    caap.setDivContent('quest_mess', 'Questing off');
                    return false;
                }

                if (whenQuest === 'Not Fortifying' || (config.getItem('PrioritiseMonsterAfterLvl', false) && state.getItem('KeepLevelUpGeneral', false))) {
                    var fortMon = state.getItem('targetFromfortify', new monster.energyTarget().data);
                    if ($j.isPlainObject(fortMon) && fortMon['md5'] && fortMon['type']) {
                        switch (fortMon['type']) {
                        case "Fortify":
                            var maxHealthtoQuest = config.getItem('MaxHealthtoQuest', 0);
                            if (!maxHealthtoQuest) {
                                caap.setDivContent('quest_mess', '<span style="font-weight: bold;">No valid over fortify %</span>');
                                return false;
                            }

                            caap.setDivContent('quest_mess', 'No questing until attack target ' + fortMon['name'] + " health exceeds " + config.getItem('MaxToFortify', 0) + '%');
                            var targetFrombattle_monster = state.getItem('targetFrombattle_monster', '');
                            // this looks like a bug and needs testing if (!targetFrombattle_monster) {
                            if (!targetFrombattle_monster) {
                                var currentMonster = monster.getItem(targetFrombattle_monster);
                                if (!currentMonster['fortify']) {
                                    if (currentMonster['fortify'] < maxHealthtoQuest) {
                                        caap.setDivContent('quest_mess', 'No questing until fortify target ' + currentMonster['name'] + ' health exceeds ' + maxHealthtoQuest + '%');
                                        return false;
                                    }
                                }
                            }

                            break;
                        case "Strengthen":
                            caap.setDivContent('quest_mess', 'No questing until attack target ' + fortMon['name'] + " at full strength.");
                            break;
                        case "Stun":
                            caap.setDivContent('quest_mess', 'No questing until attack target ' + fortMon['name'] + " stunned.");
                            break;
                        default:
                        }

                        return false;
                    }
                }

                var autoQuestName = state.getItem('AutoQuest', caap.newAutoQuest())['name'];
                if (!autoQuestName) {
                    if (config.getItem('WhyQuest', 'Manual') === 'Manual') {
                        caap.setDivContent('quest_mess', 'Pick quest manually.');
                        return false;
                    }

                    caap.setDivContent('quest_mess', 'Searching for quest.');
                    $u.log(1, "Searching for quest");
                } else {
                    var energyCheck = caap.checkEnergy(state.getItem('AutoQuest', caap.newAutoQuest())['energy'], whenQuest, 'quest_mess');
                    if (!energyCheck) {
                        return false;
                    }
                }

                if (state.getItem('AutoQuest', caap.newAutoQuest())['general'] === 'none' || config.getItem('ForceSubGeneral', false)) {
                    if (general.Select('SubQuestGeneral')) {
                        return true;
                    }
                } else if (general.LevelUpCheck('QuestGeneral')) {
                    if (general.Select('LevelUpGeneral')) {
                        return true;
                    }

                    $u.log(2, 'Using level up general');
                }

                switch (config.getItem('QuestArea', 'Quest')) {
                case 'Quest' :
                    var pathToPage  = 'quests',
                        imageOnPage = 'quest_back_1.jpg',
                        subQArea    = 'Land of Fire',
                        landPic     = '';

                    if (caap.stats['level'] > 7) {
                        subQArea = config.getItem('QuestSubArea', 'Land of Fire');
                        landPic = caap.questAreaInfo[subQArea].base;
                        if ($u.hasContent($j("img[src*='" + landPic + "_lock']"))) {
                            caap.checkResults_quests(true);
                        }

                        if (landPic === 'tab_heaven' || config.getItem('GetOrbs', false) && config.getItem('WhyQuest', 'Manual') !== 'Manual') {
                            if (caap.checkMagic()) {
                                return true;
                            }
                        }

                        pathToPage = 'quests,jobs_tab_more.gif,' + landPic;
                        imageOnPage = landPic;
                        switch (landPic) {
                        case 'tab_mist3':
                        case 'tab_mist2':
                        case 'tab_water2':
                        case 'tab_earth2':
                        case 'tab_ivory':
                        case 'tab_underworld':
                            pathToPage += '_small.gif';
                            imageOnPage += '_big.gif';
                            break;
                        case 'tab_heaven':
                            pathToPage += '_small2.gif';
                            imageOnPage += '_big2.gif';
                            break;
                        case 'land_undead_realm':
                        case 'land_demon_realm':
                            pathToPage += '.gif';
                            imageOnPage += '_sel.gif';
                            break;
                        default:
                            pathToPage = 'quests,jobs_tab_back.gif,' + landPic + '.gif';
                            imageOnPage += '_sel.gif';
                        }
                    }

                    if (caap.navigateTo(pathToPage, imageOnPage)) {
                        return true;
                    }

                    break;
                case 'Demi Quests' :
                    if (caap.navigateTo('quests,symbolquests', 'demi_quest_on.gif')) {
                        return true;
                    }

                    var subDQArea = config.getItem('QuestSubArea', 'Ambrosia'),
                        deityN    = caap.deityTable[caap.demiQuestTable[subDQArea]],
                        picSlice  = $j("#" + caap.domain.id[caap.domain.which] + "symbol_image_symbolquests" + deityN, caap.globalContainer),
                        descSlice = $j("#" + caap.domain.id[caap.domain.which] + "symbol_desc_symbolquests" + deityN, caap.globalContainer);

                    if (!$u.hasContent(picSlice) || !$u.hasContent(descSlice)) {
                        $u.warn('No diety image or description for', subDQArea);
                        return false;
                    }

                    if (descSlice.css('display') === 'none') {
                        return caap.navigateTo(picSlice.attr("src").basename());
                    }

                    break;
                case 'Atlantis' :
                    if (!caap.hasImage('tab_atlantis_on.gif')) {
                        return caap.navigateTo('quests,monster_quests');
                    }

                    break;
                default :
                }

                var bDiv   = $j("#" + caap.domain.id[caap.domain.which] + "single_popup", caap.globalContainer),
                    bDisp  = $u.setContent(bDiv.css("display"), 'none'),
                    button = $j();

                if (bDisp !== 'none') {
                    button = $j("input[src*='quick_switch_button.gif']", bDiv);
                    if ($u.hasContent(button) && !config.getItem('ForceSubGeneral', false)) {
                        $u.log(2, 'Clicking on quick switch general button.');
                        caap.click(button);
                        general.quickSwitch = true;
                        return true;
                    }
                }

                if (general.quickSwitch) {
                    caap.reBind();
                    general.GetEquippedStats();
                }

                // Buy quest requires popup
                var itemBuyPopUp = $j("form[id*='itemBuy']", caap.globalContainer),
                    costToBuy    = 0;

                if (bDisp !== 'none' && $u.hasContent(itemBuyPopUp)) {
                    $u.log(2, 'itemBuy');
                    state.setItem('storeRetrieve', 'general');
                    if (general.Select('BuyGeneral')) {
                        return true;
                    }

                    state.setItem('storeRetrieve', '');
                    costToBuy = itemBuyPopUp.text().replace(new RegExp(".*\\$"), '').replace(new RegExp("[^\\d]{3,}.*"), '').parseInt();
                    $u.log(2, "costToBuy", costToBuy);
                    if (caap.stats['gold']['cash'] < costToBuy) {
                        //Retrieving from Bank
                        if (caap.stats['gold']['cash'] + (caap.stats['gold']['bank'] - config.getItem('minInStore', 0)) >= costToBuy) {
                            $u.log(1, "Trying to retrieve", costToBuy - caap.stats['gold']['cash']);
                            state.setItem("storeRetrieve", costToBuy - caap.stats['gold']['cash']);
                            return caap.retrieveFromBank(costToBuy - caap.stats['gold']['cash']);
                        } else {
                            $u.log(1, "Cant buy requires, stopping quest");
                            caap.manualAutoQuest();
                            return false;
                        }
                    }


                    button = caap.checkForImage('quick_buy_button.jpg');
                    if ($u.hasContent(button)) {
                        $u.log(1, 'Clicking on quick buy button.');
                        caap.click(button);
                        return true;
                    }

                    $u.warn("Cant find buy button");
                    return false;
                }

                button = caap.checkForImage('quick_buy_button.jpg');
                if (bDisp !== 'none' && $u.hasContent(button)) {
                    $u.log(2, 'quick_buy_button');
                    state.setItem('storeRetrieve', 'general');
                    if (general.Select('BuyGeneral')) {
                        return true;
                    }

                    state.setItem('storeRetrieve', '');
                    costToBuy = $j("strong", button.parents("form").eq(0)).text().replace(new RegExp("[^0-9]", "g"), '');
                    $u.log(2, "costToBuy", costToBuy);
                    if (caap.stats['gold']['cash'] < costToBuy) {
                        //Retrieving from Bank
                        if (caap.stats['gold']['cash'] + (caap.stats['gold']['bank'] - config.getItem('minInStore', 0)) >= costToBuy) {
                            $u.log(1, "Trying to retrieve: ", costToBuy - caap.stats['gold']['cash']);
                            state.setItem("storeRetrieve", costToBuy - caap.stats['gold']['cash']);
                            return caap.retrieveFromBank(costToBuy - caap.stats['gold']['cash']);
                        } else {
                            $u.log(1, "Cant buy General, stopping quest");
                            caap.manualAutoQuest();
                            return false;
                        }
                    }

                    $u.log(2, 'Clicking on quick buy general button.');
                    caap.click(button);
                    return true;
                }

                var autoQuestDivs = {
                        name     : '',
                        click    : $j(),
                        tr       : $j(),
                        genDiv   : $j(),
                        orbCheck : false
                    };

                autoQuestDivs = caap.checkResults_quests(true);
                //$u.log(1, 'autoQuestDivs/autoQuestName', autoQuestDivs, autoQuestName);
                if (!autoQuestDivs.name) {
                    $u.log(1, 'Could not find AutoQuest.');
                    caap.setDivContent('quest_mess', 'Could not find AutoQuest.');
                    return false;
                }

                if (autoQuestDivs.name !== autoQuestName) {
                    $u.log(1, 'New AutoQuest found.');
                    caap.setDivContent('quest_mess', 'New AutoQuest found.');
                    return true;
                }

                // if found missing requires, click to buy
                if ($u.hasContent(autoQuestDivs.tr)) {
                    var background = $j("div[style*='background-color']", autoQuestDivs.tr);
                    if ($u.hasContent(background) && background.css("background-color") === 'rgb(158, 11, 15)') {
                        $u.log(1, "Missing item");
                        if (config.getItem('QuestSubArea', 'Atlantis') === 'Atlantis') {
                            $u.log(1, "Cant buy Atlantis items, stopping quest");
                            caap.manualAutoQuest();
                            return false;
                        }

                        $u.log(2, "background.style.backgroundColor", background.css("background-color"));
                        state.setItem('storeRetrieve', 'general');
                        if (general.Select('BuyGeneral')) {
                            return true;
                        }

                        state.setItem('storeRetrieve', '');
                        $u.log(2, "background.children().eq(0).children().eq(0).attr('title')", background.children().eq(0).children().eq(0).attr("title"));
                        if (background.children().eq(0).children().eq(0).attr("title")) {
                            $u.log(2, "Clicking to buy", background.children().eq(0).children().eq(0).attr("title"));
                            caap.click(background.children().eq(0).children().eq(0));
                            return true;
                        }
                    }
                } else {
                    $u.warn('Can not buy quest item');
                    return false;
                }

                var questGeneral = state.getItem('AutoQuest', caap.newAutoQuest())['general'];
                if (questGeneral === 'none' || config.getItem('ForceSubGeneral', false)) {
                    if (general.Select('SubQuestGeneral')) {
                        return true;
                    }
                } else if (questGeneral && questGeneral !== general.GetCurrent()) {
                    if (general.LevelUpCheck("QuestGeneral")) {
                        if (general.Select('LevelUpGeneral')) {
                            return true;
                        }

                        $u.log(2, 'Using level up general');
                    } else {
                        if ($u.hasContent(autoQuestDivs.genDiv)) {
                            $u.log(2, 'Clicking on general', questGeneral);
                            caap.click(autoQuestDivs.genDiv);
                            return true;
                        } else {
                            $u.warn('Can not click on general', questGeneral);
                            return false;
                        }
                    }
                }

                if ($u.hasContent(autoQuestDivs.click)) {
                    $u.log(2, 'Clicking auto quest', autoQuestName);
                    state.setItem('ReleaseControl', true);
                    caap.click(autoQuestDivs.click);
                    caap.showAutoQuest();
                    if (autoQuestDivs.orbCheck) {
                        schedule.setItem("magic", 0);
                    }

                    return true;
                } else {
                    $u.warn('Can not click auto quest', autoQuestName);
                    return false;
                }
            } catch (err) {
                $u.error("ERROR in quests: " + err);
                return false;
            }
        },

        questName: null,

        checkResults_symbolquests: function () {
            try {
                $j("div[id*='symbol_tab_symbolquests']", caap.appBodyDiv).unbind('click', caap.symbolquestsListener).bind('click', caap.symbolquestsListener);
                $j("form[id*='symbols_form_']", caap.appBodyDiv).unbind('click', caap.symbolquestsClickListener).bind('click', caap.symbolquestsClickListener);
                var demiDiv = $j("div[id*='symbol_desc_symbolquests']", caap.globalContainer),
                    points  = [],
                    success = true;

                caap.blessingResults();
                if ($u.hasContent(demiDiv) && demiDiv.length === 5) {
                    demiDiv.each(function () {
                        var num = $u.setContent($j(this).children().next().eq(1).children().children().next().text(), '').trim().innerTrim().regex(/(\d+)/);
                        if ($u.hasContent(num) && !$u.isNaN(num)) {
                            points.push(num);
                        } else {
                            success = false;
                            $u.warn('Demi-Power text problem');
                        }
                    });

                    if (success) {
                        $u.log(3, 'Demi-Power Points', points);
                        caap.demi['ambrosia']['power']['total'] = $u.setContent(points[0], 0);
                        caap.demi['malekus']['power']['total'] = $u.setContent(points[1], 0);
                        caap.demi['corvintheus']['power']['total'] = $u.setContent(points[2], 0);
                        caap.demi['aurora']['power']['total'] = $u.setContent(points[3], 0);
                        caap.demi['azeron']['power']['total'] = $u.setContent(points[4], 0);
                        schedule.setItem("symbolquests", gm.getItem("checkSymbolQuests", 24, hiddenVar) * 3600, 300);
                        caap.SaveDemi();
                    }
                } else {
                    $u.warn("Demi demiDiv problem", demiDiv);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_symbolquests: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        isBossQuest: function (name) {
            try {
                var qn    = '',
                    found = false;

                for (qn in caap.questAreaInfo) {
                    if (caap.questAreaInfo.hasOwnProperty(qn)) {
                        if (caap.questAreaInfo[qn].boss && caap.questAreaInfo[qn].boss === name) {
                            found = true;
                            break;
                        }
                    }
                }

                return found;
            } catch (err) {
                $u.error("ERROR in isBossQuest: " + err);
                return false;
            }
        },

        symbolquestsListener: function (event) {
            $u.log(3, "Clicked Demi Power image", event.target.parentNode.parentNode.parentNode.parentNode.id);
            state.setItem('clickUrl', caap.domain.link + '/symbolquests.php');
            caap.checkResults();
        },

        symbolquestsClickListener: function (event) {
            $u.log(3, "Clicked Demi Power blessing", event.target.parentNode.id);
            state.setItem('clickUrl', caap.domain.link + '/symbolquests.php');
            caap.blessingPerformed = true;
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checkResults_quests: function (pickQuestTF) {
            try {
                //$u.log(1, "checkResults_quests pickQuestTF", pickQuestTF);
                pickQuestTF = pickQuestTF ? pickQuestTF : false;
                if ($u.hasContent($j("#" + caap.domain.id[caap.domain.which] + "quest_map_container", caap.globalContainer))) {
                    $j("div[id*='meta_quest_']", caap.appBodyDiv).each(function (index) {
                        var row = $j(this);
                        if (!($u.hasContent($j("img[src*='_completed']", row)) || $u.hasContent($j("img[src*='_locked']", row)))) {
                            $j("div[id*='quest_wrapper_" + row.attr("id").replace(caap.domain.id[caap.domain.which] + "meta_quest_", '') + "']", caap.globalContainer).css("display", "block");
                        }
                    });
                }

                if (config.getItem("enableTitles", true)) {
                    spreadsheet.doTitles();
                }

                var whyQuest = config.getItem('WhyQuest', 'Manual');
                if (pickQuestTF === true && whyQuest !== 'Manual') {
                    state.setItem('AutoQuest', caap.newAutoQuest());
                }

                var bestReward  = 0,
                    rewardRatio = 0,
                    div         = $j(),
                    ss          = $j();

                if (caap.hasImage('demi_quest_on.gif')) {
                    caap.checkResults_symbolquests($u.isString(pickQuestTF) ? pickQuestTF : undefined);
                    ss = $j("div[id*='symbol_displaysymbolquest']", caap.globalContainer);
                    if (!$u.hasContent(ss)) {
                        $u.warn("Failed to find symbol_displaysymbolquest");
                    }

                    ss.each(function () {
                        div = $j(this);
                        if (div.css("display") !== 'none') {
                            return false;
                        }

                        return true;
                    });
                } else {
                    div = caap.globalContainer;
                }

                ss = $j(".quests_background,.quests_background_sub", div);
                if (!$u.hasContent(ss)) {
                    $u.warn("Failed to find quests_background");
                    return false;
                }

                var haveOrb      = false,
                    isTheArea    = false,
                    questSubArea = '';

                questSubArea = config.getItem('QuestSubArea', 'Land of Fire');
                isTheArea = caap.checkCurrentQuestArea(questSubArea);
                $u.log(2, "Is quest area", questSubArea, isTheArea);
                if (isTheArea && whyQuest !== 'Manual' && config.getItem('GetOrbs', false)) {
                    if ($u.hasContent($j("input[alt='Perform Alchemy']"))) {
                        haveOrb = true;
                    } else {
                        if (questSubArea && caap.questAreaInfo[questSubArea].orb) {
                            haveOrb = town.haveOrb(caap.questAreaInfo[questSubArea].orb);
                        }
                    }

                    $u.log(2, "Have Orb for", questSubArea, haveOrb);
                    if (haveOrb && caap.isBossQuest(state.getItem('AutoQuest', caap.newAutoQuest())['name'])) {
                        state.setItem('AutoQuest', caap.newAutoQuest());
                    }
                }

                var autoQuestDivs = {
                    name     : '',
                    click    : $j(),
                    tr       : $j(),
                    genDiv   : $j(),
                    orbCheck : false
                };

                $j(".autoquest", caap.appBodyDiv).remove();
                var expRegExp       = new RegExp("\\+(\\d+)"),
                    energyRegExp    = new RegExp("(\\d+)\\s+energy", "i"),
                    moneyRegExp     = new RegExp("\\$([0-9,]+)\\s*-\\s*\\$([0-9,]+)", "i"),
                    money2RegExp    = new RegExp("\\$([0-9,]+)mil\\s*-\\s*\\$([0-9,]+)mil", "i"),
                    influenceRegExp = new RegExp("(\\d+)%");

                ss.each(function () {
                    div = $j(this);
                    caap.questName = caap.getQuestName(div);
                    if (!caap.questName) {
                        return true;
                    }

                    var reward     = null,
                        energy     = null,
                        experience = null,
                        divTxt     = '',
                        expM       = [],
                        tStr       = '';

                    divTxt = div.text().trim().innerTrim();
                    expM = divTxt ? divTxt.match(expRegExp) : [];
                    if (expM && expM.length === 2) {
                        experience = expM[1] ? expM[1].numberOnly() : 0;
                    } else {
                        var expObj = $j(".quest_experience", div);
                        if ($u.hasContent(expObj)) {
                            tStr = expObj.text();
                            experience = tStr ? tStr.numberOnly() : 0;
                        } else {
                            $u.warn("Can't find experience for", caap.questName);
                        }
                    }

                    var idx = caap.questName.indexOf('<br>');
                    if (idx >= 0) {
                        caap.questName = caap.questName.substring(0, idx);
                    }

                    var energyM = divTxt.match(energyRegExp);
                    if (energyM && energyM.length === 2) {
                        energy = energyM[1] ? energyM[1].numberOnly() : 0;
                    } else {
                        var eObj = $j(".quest_req", div);
                        if ($u.hasContent(eObj)) {
                            energy = $j('b', eObj).eq(0).text().numberOnly();
                        }
                    }

                    if (!energy) {
                        $u.warn("Can't find energy for", caap.questName);
                        return true;
                    }

                    var moneyM     = [],
                        rewardLow  = 0,
                        rewardHigh = 0;

                    moneyM = divTxt ? divTxt.stripHtmlJunk().match(moneyRegExp) : [];
                    if (moneyM && moneyM.length === 3) {
                        rewardLow  = moneyM[1] ? moneyM[1].numberOnly() : 0;
                        rewardHigh = moneyM[2] ? moneyM[2].numberOnly() : 0;
                        reward = (rewardLow + rewardHigh) / 2;
                    } else {
                        moneyM = divTxt ? divTxt.stripHtmlJunk().match(money2RegExp) : [];
                        if (moneyM && moneyM.length === 3) {
                            rewardLow  = moneyM[1] ? moneyM[1].numberOnly() * 1000000 : 0;
                            rewardHigh = moneyM[2] ? moneyM[2].numberOnly() * 1000000 : 0;
                            reward = (rewardLow + rewardHigh) / 2;
                        } else {
                            $u.warn('No money found for', caap.questName, divTxt);
                        }
                    }

                    var click = $j("input[name='Do Quest']", div);
                    if (!$u.hasContent(click)) {
                        $u.warn('No button found for', caap.questName);
                        return true;
                    }

                    var influence = -1;
                    if (caap.isBossQuest(caap.questName)) {
                        if ($u.hasContent($j(".quests_background_sub", div))) {
                            //if boss and found sub quests
                            influence = 100;
                        } else {
                            influence = 0;
                        }
                    } else {
                        var influenceList = divTxt.match(influenceRegExp);
                        if (influenceList && influenceList.length === 2) {
                            influence = influenceList[1] ? influenceList[1].parseInt() : 0;
                        } else {
                            $u.warn("Influence div not found.", influenceList);
                        }
                    }

                    if (influence < 0) {
                        $u.warn('No influence found for', caap.questName, divTxt);
                    }

                    var general = 'none',
                        genDiv  = $j();

                    if (influence >= 0 && influence < 100) {
                        genDiv = $j(".quest_act_gen", div);
                        if ($u.hasContent(genDiv)) {
                            genDiv = $j("img[src*='jpg']", genDiv);
                            if ($u.hasContent(genDiv)) {
                                general = genDiv.attr("title");
                            }
                        }
                    }

                    var questType = 'subquest';
                    if (div.attr("class") === 'quests_background') {
                        questType = 'primary';
                    } else if (div.attr("class") === 'quests_background_special') {
                        questType = 'boss';
                    }

                    caap.labelQuests(div, energy, reward, experience, click);
                    $u.log(9, "QuestSubArea", questSubArea);
                    if (isTheArea) {
                        if (config.getItem('GetOrbs', false) && questType === 'boss' && whyQuest !== 'Manual' && !haveOrb) {
                            caap.updateAutoQuest('name', caap.questName);
                            pickQuestTF = true;
                            autoQuestDivs.orbCheck = true;
                        }

                        switch (whyQuest) {
                        case 'Advancement' :
                            if (influence >= 0) {
                                if (!state.getItem('AutoQuest', caap.newAutoQuest())['name'] && questType === 'primary' && influence < 100) {
                                    caap.updateAutoQuest('name', caap.questName);
                                    pickQuestTF = true;
                                }
                            } else {
                                $u.warn("Can't find influence for", caap.questName, influence);
                            }

                            break;
                        case 'Max Influence' :
                            if (influence >= 0) {
                                if (!state.getItem('AutoQuest', caap.newAutoQuest())['name'] && influence < 100) {
                                    caap.updateAutoQuest('name', caap.questName);
                                    pickQuestTF = true;
                                }
                            } else {
                                $u.warn("Can't find influence for", caap.questName, influence);
                            }

                            break;
                        case 'Max Experience' :
                            rewardRatio = (Math.floor(experience / energy * 100) / 100);
                            if (bestReward < rewardRatio) {
                                caap.updateAutoQuest('name', caap.questName);
                                pickQuestTF = true;
                            }

                            break;
                        case 'Max Gold' :
                            rewardRatio = (Math.floor(reward / energy * 10) / 10);
                            if (bestReward < rewardRatio) {
                                caap.updateAutoQuest('name', caap.questName);
                                pickQuestTF = true;
                            }

                            break;
                        default :
                        }

                        if (isTheArea && state.getItem('AutoQuest', caap.newAutoQuest())['name'] === caap.questName) {
                            bestReward = rewardRatio;
                            var expRatio = experience / (energy ? energy : 1);
                            $u.log(2, "Setting AutoQuest", caap.questName);
                            var tempAutoQuest = caap.newAutoQuest();
                            tempAutoQuest['name'] = caap.questName;
                            tempAutoQuest['energy'] = energy;
                            tempAutoQuest['general'] = general;
                            tempAutoQuest['expRatio'] = expRatio;
                            state.setItem('AutoQuest', tempAutoQuest);
                            $u.log(4, "checkResults_quests", state.getItem('AutoQuest', caap.newAutoQuest()));
                            caap.showAutoQuest();
                            autoQuestDivs.name = caap.questName;
                            autoQuestDivs.click = click;
                            autoQuestDivs.tr = div;
                            autoQuestDivs.genDiv = genDiv;
                        }
                    }

                    //$u.log(1, "End of run");
                    return true;
                });

                $u.log(4, "pickQuestTF", pickQuestTF);
                if (pickQuestTF) {
                    if (state.getItem('AutoQuest', caap.newAutoQuest())['name']) {
                        $u.log(4, "return autoQuestDivs", autoQuestDivs);
                        caap.showAutoQuest();
                        return autoQuestDivs;
                    }

                    //if not find quest, probably you already maxed the subarea, try another area
                    if ((whyQuest === 'Max Influence' || whyQuest === 'Advancement') && config.getItem('switchQuestArea', true)) {
                        $u.log(9, "QuestSubArea", questSubArea);
                        if (questSubArea && caap.questAreaInfo[questSubArea] && caap.questAreaInfo[questSubArea].next) {
                            questSubArea = config.setItem('QuestSubArea', caap.questAreaInfo[questSubArea].next);
                            if (caap.questAreaInfo[questSubArea].area && caap.questAreaInfo[questSubArea].list) {
                                config.setItem('QuestArea', caap.questAreaInfo[questSubArea].area);
                                caap.changeDropDownList('QuestSubArea', caap[caap.questAreaInfo[questSubArea].list]);
                            }
                        } else {
                            $u.log(1, "Setting questing to manual");
                            caap.manualAutoQuest();
                        }

                        $u.log(2, "UpdateQuestGUI: Setting drop down menus");
                        caap.selectDropOption('QuestArea', config.getItem('QuestArea', 'Quest'));
                        caap.selectDropOption('QuestSubArea', questSubArea);
                        return false;
                    }

                    $u.log(1, "Finished QuestArea.");
                    caap.manualAutoQuest();
                }

                return false;
            } catch (err) {
                $u.error("ERROR in checkResults_quests: " + err);
                caap.manualAutoQuest();
                return false;
            }
        },

        classToQuestArea: {
            'quests_stage_1'         : 'Land of Fire',
            'quests_stage_2'         : 'Land of Earth',
            'quests_stage_3'         : 'Land of Mist',
            'quests_stage_4'         : 'Land of Water',
            'quests_stage_5'         : 'Demon Realm',
            'quests_stage_6'         : 'Undead Realm',
            'quests_stage_7'         : 'Underworld',
            'quests_stage_8'         : 'Kingdom of Heaven',
            'quests_stage_9'         : 'Ivory City',
            'quests_stage_10'        : 'Earth II',
            'quests_stage_11'        : 'Water II',
            'quests_stage_12'        : 'Mist II',
            'quests_stage_13'        : 'Mist III',
            'symbolquests_stage_1'   : 'Ambrosia',
            'symbolquests_stage_2'   : 'Malekus',
            'symbolquests_stage_3'   : 'Corvintheus',
            'symbolquests_stage_4'   : 'Aurora',
            'symbolquests_stage_5'   : 'Azeron',
            'monster_quests_stage_1' : 'Atlantis'
        },

        checkCurrentQuestArea: function (QuestSubArea) {
            try {
                var found = false;

                if (caap.stats['level'] < 8) {
                    if (caap.hasImage('quest_back_1.jpg')) {
                        found = true;
                    }
                } else if (QuestSubArea && caap.questAreaInfo[QuestSubArea]) {
                    if ($u.hasContent($j("div[class='" + caap.questAreaInfo[QuestSubArea].clas + "']", caap.globalContainer))) {
                        found = true;
                    }
                }

                return found;
            } catch (err) {
                $u.error("ERROR in checkCurrentQuestArea: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        getQuestName: function (questDiv) {
            try {
                var item_title = $j(".quest_desc,.quest_sub_title", questDiv),
                    firstb     = $j("b", item_title).eq(0),
                    text       = '';

                if (!$u.hasContent(item_title)) {
                    $u.log(2, "Can't find quest description or sub-title");
                    return false;
                }

                text = item_title.html().trim().innerTrim();
                if (/LOCK/.test(text) || /boss_locked/.test(text)) {
                    $u.log(2, "Quest locked", text);
                    return false;
                }

                if (!$u.hasContent(firstb)) {
                    $u.warn("Can't get bolded member out of", text);
                    return false;
                }

                caap.questName = firstb.text().trim().innerTrim();
                if (!$u.hasContent(caap.questName)) {
                    $u.warn('No quest name for this row');
                    return false;
                }

                return caap.questName;
            } catch (err) {
                $u.error("ERROR in getQuestName: " + err);
                return false;
            }
        },

        /*------------------------------------------------------------------------------------\
        checkEnergy gets passed the default energy requirement plus the condition text from
        the 'Whenxxxxx' setting and the message div name.
        \------------------------------------------------------------------------------------*/
        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checkEnergy: function (energy, condition, msgdiv) {
            try {
                if (!caap.stats['energy'] || !energy) {
                    return false;
                }

                if (condition === 'Energy Available' || condition === 'Not Fortifying') {
                    if (caap.stats['energy']['num'] >= energy) {
                        return true;
                    }

                    if (msgdiv) {
                        caap.setDivContent(msgdiv, 'Waiting for more energy: ' + caap.stats['energy']['num'] + "/" + (energy ? energy : ""));
                    }
                } else if (condition === 'At X Energy') {
                    if (caap.inLevelUpMode() && caap.stats['energy']['num'] >= energy) {
                        if (msgdiv) {
                            caap.setDivContent(msgdiv, 'Burning all energy to level up');
                        }

                        return true;
                    }

                    var whichEnergy = config.getItem('XQuestEnergy', 1);
                    if (caap.stats['energy']['num'] >= whichEnergy) {
                        state.setItem('AtXQuestEnergy', true);
                    }

                    if (caap.stats['energy']['num'] >= energy) {
                        if (state.getItem('AtXQuestEnergy', false) && caap.stats['energy']['num'] >= config.getItem('XMinQuestEnergy', 0)) {
                            caap.setDivContent(msgdiv, 'At X energy. Burning to ' + config.getItem('XMinQuestEnergy', 0));
                            return true;
                        } else {
                            state.setItem('AtXQuestEnergy', false);
                        }
                    }

                    if (energy > whichEnergy) {
                        whichEnergy = energy;
                    }

                    if (msgdiv) {
                        caap.setDivContent(msgdiv, 'Waiting for X energy: ' + caap.stats['energy']['num'] + "/" + whichEnergy);
                    }
                } else if (condition === 'At Max Energy') {
                    var maxIdleEnergy = caap.stats['energy']['max'],
                        theGeneral = config.getItem('IdleGeneral', 'Use Current');

                    if (theGeneral !== 'Use Current') {
                        maxIdleEnergy = general.GetEnergyMax(theGeneral);
                    }

                    if (theGeneral !== 'Use Current' && !maxIdleEnergy) {
                        $u.log(2, "Changing to idle general to get Max energy");
                        if (general.Select('IdleGeneral')) {
                            return true;
                        }
                    }

                    if (caap.stats['energy']['num'] >= maxIdleEnergy) {
                        return true;
                    }

                    if (caap.inLevelUpMode() && caap.stats['energy']['num'] >= energy) {
                        if (msgdiv) {
                            $u.log(1, "Burning all energy to level up");
                            caap.setDivContent(msgdiv, 'Burning all energy to level up');
                        }

                        return true;
                    }

                    if (msgdiv) {
                        caap.setDivContent(msgdiv, 'Waiting for max energy: ' + caap.stats['energy']['num'] + "/" + maxIdleEnergy);
                    }
                }

                return false;
            } catch (err) {
                $u.error("ERROR in checkEnergy: " + err);
                return false;
            }
        },

        labelListener: function (e) {
            try {
                var sps           = e.target.getElementsByTagName('span'),
                    mainDiv       = $j("#" + caap.domain.id[caap.domain.which] + "main_bn", caap.globalContainer),
                    className     = '',
                    tempAutoQuest = {};

                if (sps.length <= 0) {
                    throw 'what did we click on?';
                }

                tempAutoQuest = caap.newAutoQuest();
                tempAutoQuest['name'] = sps[0].innerHTML;
                tempAutoQuest['energy'] = sps[1].innerHTML.parseInt();
                //tempAutoQuest['general'] = general;
                //tempAutoQuest['expRatio'] = expRatio;

                caap.manualAutoQuest(tempAutoQuest);
                $u.log(5, 'labelListener', sps, state.getItem('AutoQuest'));
                if (caap.stats['level'] < 8 && caap.hasImage('quest_back_1.jpg')) {
                    config.setItem('QuestArea', 'Quest');
                    config.setItem('QuestSubArea', 'Land of Fire');
                } else {
                    if (caap.hasImage('tab_quest_on.gif')) {
                        config.setItem('QuestArea', 'Quest');
                        caap.selectDropOption('QuestArea', 'Quest');
                        caap.changeDropDownList('QuestSubArea', caap.landQuestList);
                    } else if (caap.hasImage('demi_quest_on.gif')) {
                        config.setItem('QuestArea', 'Demi Quests');
                        caap.selectDropOption('QuestArea', 'Demi Quests');
                        caap.changeDropDownList('QuestSubArea', caap.demiQuestList);
                    } else if (caap.hasImage('tab_atlantis_on.gif')) {
                        config.setItem('QuestArea', 'Atlantis');
                        caap.selectDropOption('QuestArea', 'Atlantis');
                        caap.changeDropDownList('QuestSubArea', caap.atlantisQuestList);
                    }

                    if ($u.hasContent(mainDiv)) {
                        className = mainDiv.attr("class");
                        if ($u.hasContent(className) && caap.classToQuestArea[className]) {
                            config.setItem('QuestSubArea', caap.classToQuestArea[className]);
                        }
                    }
                }

                $u.log(1, 'Setting QuestSubArea to', config.getItem('QuestSubArea', 'Land Of Fire'));
                caap.selectDropOption('QuestSubArea', config.getItem('QuestSubArea', 'Land Of Fire'));
                caap.showAutoQuest();
                caap.checkResults_quests();
                return true;
            } catch (err) {
                $u.error("ERROR in labelListener: " + err);
                return false;
            }
        },

        labelQuests: function (div, energy, reward, experience, click) {
            try {
                if ($u.hasContent($j("div[class='autoquest']", div))) {
                    return;
                }

                var newdiv = {};
                newdiv = document.createElement('div');
                newdiv.className = 'autoquest';
                newdiv.style.fontSize = '10px';
                newdiv.innerHTML = "$ per energy: " + (Math.floor(reward / energy * 10) / 10) +
                    "<br />Exp per energy: " + (Math.floor(experience / energy * 100) / 100) + "<br />";

                if (state.getItem('AutoQuest', caap.newAutoQuest())['name'] === caap.questName) {
                    var b = document.createElement('b');
                    b.innerHTML = "Current auto quest";
                    newdiv.appendChild(b);
                } else {
                    var setAutoQuest = document.createElement('a');
                    setAutoQuest.innerHTML = 'Auto run this quest.';
                    setAutoQuest.quest_name = caap.questName;

                    var quest_nameObj = document.createElement('span');
                    quest_nameObj.innerHTML = caap.questName;
                    quest_nameObj.style.display = 'none';
                    setAutoQuest.appendChild(quest_nameObj);

                    var quest_energyObj = document.createElement('span');
                    quest_energyObj.innerHTML = energy;
                    quest_energyObj.style.display = 'none';
                    setAutoQuest.appendChild(quest_energyObj);
                    setAutoQuest.addEventListener("click", caap.labelListener, false);

                    newdiv.appendChild(setAutoQuest);
                }

                newdiv.style.position = 'absolute';
                newdiv.style.background = '#B09060';
                newdiv.style.right = "144px";
                click.parent().before(newdiv);
            } catch (err) {
                $u.error("ERROR in labelQuests: " + err);
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          AUTO BLESSING
        /////////////////////////////////////////////////////////////////////

        deityTable: {
            'energy'  : 1,
            'attack'  : 2,
            'defense' : 3,
            'health'  : 4,
            'stamina' : 5
        },
        /*jslint sub: false */

        blessingPerformed: false,

        blessingResults: function () {
            try {
                var hours   = 0,
                    minutes = 0,
                    done    = false;

                if (caap.blessingPerformed) {
                    if (/Please come back in:/i.test(caap.resultsText)) {
                        // Check time until next Oracle Blessing
                        hours = $u.setContent(caap.resultsText.regex(/(\d+) hour/i), 3);
                        minutes = $u.setContent(caap.resultsText.regex(/(\d+) minute/i), 0);
                        done = true;
                    } else if (/You have paid tribute to/i.test(caap.resultsText)) {
                        // Recieved Demi Blessing.  Wait X hours to try again.
                        hours = /Azeron/i.test(caap.resultsText) ? 48 : 24;
                        done = true;
                    } else {
                        if ($u.hasContent(caap.resultsText)) {
                            $u.warn("Unknown blessing result text", caap.resultsText);
                        }
                    }

                    if (done) {
                        $u.log(2, 'Recorded Blessing Time. Scheduling next click! ' + hours + ':' + (minutes < 10 ? '0' + minutes : minutes));
                        schedule.setItem('BlessingTimer', (hours * 60 + minutes + 5) * 60, 300);
                    }

                    caap.blessingPerformed = false;
                }
            } catch (err) {
                $u.error("ERROR in blessingResults: " + err);
            }
        },

        autoBless: function () {
            try {
                if (caap.blessingPerformed) {
                    return true;
                }

                var autoBless  = config.getItem('AutoBless', 'none'),
                    autoBlessN = caap.deityTable[autoBless.toLowerCase()],
                    picSlice   = $j(),
                    descSlice  = $j();

                if (!$u.hasContent(autoBlessN) || !schedule.check('BlessingTimer')) {
                    return false;
                }

                if (caap.navigateTo('quests,demi_quest_off', 'demi_quest_bless')) {
                    return true;
                }

                picSlice = $j("#" + caap.domain.id[caap.domain.which] + "symbol_image_symbolquests" + autoBlessN, caap.appBodyDiv);
                if (!$u.hasContent(picSlice)) {
                    $u.warn('No diety image for', autoBless);
                    return false;
                }

                descSlice = $j("#" + caap.domain.id[caap.domain.which] + "symbol_desc_symbolquests" + autoBlessN, caap.appBodyDiv);
                if (!$u.hasContent(descSlice)) {
                    $u.warn('No diety description for', autoBless);
                    return false;
                }

                if (descSlice.css('display') === 'none') {
                    return caap.navigateTo(picSlice.attr("src").basename());
                }

                picSlice = $j("#" + caap.domain.id[caap.domain.which] + "symbols_form_" + autoBlessN + " input[name='symbolsubmit']", descSlice);
                if (!$u.hasContent(picSlice)) {
                    $u.warn('No image for deity blessing', autoBless);
                    return false;
                }

                $u.log(1, 'Click deity blessing for', autoBless, autoBlessN);
                schedule.setItem('BlessingTimer', 300, 300);
                caap.blessingPerformed = true;
                caap.click(picSlice);
                return true;
            } catch (err) {
                $u.error("ERROR in autoBless: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          FESTIVAL BLESSING
        /////////////////////////////////////////////////////////////////////

        checkResults_festival_tower:  function () {
            try {
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_festival_tower: " + err);
                return false;
            }
        },

        festivalBlessTable: {
            'attack'  : 'defense',
            'defense' : 'energy',
            'energy'  : 'stamina',
            'stamina' : 'health',
            'health'  : 'army',
            'army'    : 'attack'
        },

        festivalBlessGeneral: {
            'attack'  : 'DuelGeneral',
            'defense' : 'FortifyGeneral',
            'energy'  : 'IdleGeneral',
            'stamina' : 'IdleGeneral',
            'health'  : 'IdleGeneral',
            'army'    : 'InvadeGeneral'
        },
        /*jslint sub: false */

        festivalBlessResults: function () {
            try {
                var hours     = 0,
                    minutes   = 0,
                    tDiv      = $j(),
                    txt       = '',
                    autoBless = config.getItem('festivalBless', 'None');

                if (autoBless !== 'None') {
                    tDiv = $j("div[style*='festival_feats_bottom.jpg']", caap.globalContainer);
                    txt = $u.setContent(tDiv.text(), '').trim().innerTrim().regex(/(\d+:\d+)/);
                    if ($u.hasContent(txt)) {
                        // Check time until next Festival Blessing
                        hours = $u.setContent(txt.regex(/(\d+):/), 0);
                        minutes = $u.setContent(txt.regex(/:(\d+)/), 30);
                        $u.log(2, 'Recorded Festival Blessing Time. Scheduling next click! ' + hours + ':' + (minutes < 10 ? '0' + minutes : minutes));
                        schedule.setItem('festivalBlessTimer', (hours * 60 + minutes + 5) * 60, 300);
                    }

                    tDiv = $j("div[style*='festival_victory_popup.jpg']", caap.globalContainer);
                    if ($u.hasContent(tDiv)) {
                        $u.log(1, "Festival Feat Victory!");
                    } else {
                        tDiv = $j("div[style*='festival_defeat_popup.jpg']", caap.globalContainer);
                        if ($u.hasContent(tDiv)) {
                            $u.log(1, "Festival Feat Defeat!");
                            $j("#caap_festivalBless", caap.caapDivObject).val(config.setItem('festivalBless', caap.festivalBlessTable[autoBless.toLowerCase()].ucFirst()));
                        }
                    }
                }
            } catch (err) {
                $u.error("ERROR in festivalBlessResults: " + err);
            }
        },

        festivalBless: function () {
            try {
                var autoBless  = config.getItem('festivalBless', 'None'),
                    capPic     = 'festival_capsule_' + autoBless.toLowerCase() + '.gif',
                    tgeneral   = caap.festivalBlessGeneral[autoBless.toLowerCase()],
                    luGeneral  = config.getItem('LevelUpGeneral', 'Use Current'),
                    picSlice   = $j(),
                    txt        = '';

                if (autoBless === 'None' || !schedule.check('festivalBlessTimer')) {
                    return false;
                }

                tgeneral = tgeneral === 'IdleGeneral' ? (luGeneral !== 'Use Current' ? 'LevelUpGeneral' : tgeneral) : tgeneral;
                if (general.Select(tgeneral)) {
                    return true;
                }

                if (caap.navigateTo('soldiers,tab_festival_off.jpg,festival_feat_nav,' + capPic, 'festival_feats_bottom.jpg')) {
                    return true;
                }

                txt = $u.setContent($j("div[style*='festival_feats_middle.jpg'] strong", caap.appBodyDiv).text(), '').trim().innerTrim();
                if (/Mastered/i.test(txt)) {
                    $u.log(1, 'Area Completed!', autoBless);
                    $j("#caap_festivalBless", caap.caapDivObject).val(config.setItem('festivalBless', caap.festivalBlessTable[autoBless.toLowerCase()].ucFirst()));
                    caap.navigateTo('soldiers,tab_festival_off.jpg,festival_feat_nav');
                    return false;
                }

                if (!new RegExp(autoBless).test(txt)) {
                    $u.warn('No match for text', autoBless);
                    caap.navigateTo('soldiers,tab_festival_off.jpg,festival_feat_nav');
                    return false;
                }

                picSlice = $j("img[src*='festival_feat_completedbutton.jpg']", caap.appBodyDiv);
                if ($u.hasContent(picSlice)) {
                    $u.log(1, 'Area Completed!', autoBless);
                    $j("#caap_festivalBless", caap.caapDivObject).val(config.setItem('festivalBless', caap.festivalBlessTable[autoBless.toLowerCase()].ucFirst()));
                    caap.navigateTo('soldiers,tab_festival_off.jpg,festival_feat_nav');
                    return false;
                }

                picSlice = $j("input[src*='festival_feat_testbutton.jpg']", caap.appBodyDiv);
                if (!$u.hasContent(picSlice)) {
                    $u.warn('No blessing button', autoBless);
                    caap.navigateTo('soldiers,tab_festival_off.jpg,festival_feat_nav');
                    return false;
                }

                $u.log(1, 'Click blessing button for', autoBless);
                schedule.setItem('festivalBlessTimer', 300, 300);
                caap.click(picSlice);
                return true;
            } catch (err) {
                $u.error("ERROR in festivalBless: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          LAND
        // Displays return on lands and perfom auto purchasing
        /////////////////////////////////////////////////////////////////////

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        landRecord: function () {
            this.data = {
                'row'         : $j(),
                'name'        : '',
                'income'      : 0,
                'cost'        : 0,
                'totalCost'   : 0,
                'owned'       : 0,
                'maxAllowed'  : 0,
                'buy'         : 0,
                'roi'         : 0,
                'set'         : 0,
                'last'        : 0
            };
        },
        /*jslint sub: false */

        bestLand: {},

        sellLand: {},

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checkResults_land: function () {
            try {
                var ss           = $j("div[style*='town_land_bar']", caap.appBodyDiv),
                    bestLandCost = {};

                if (!$u.hasContent(ss)) {
                    $u.warn("Can't find town_land_bar.jpg");
                    return false;
                }

                caap.bestLand = state.setItem('BestLandCost', new caap.landRecord().data);
                caap.sellLand = {};

                function selectLands(div, val, type) {
                    try {
                        type = type ? type : 'Buy';
                        var selects = $j("select", div);
                        if (!$u.hasContent(selects)) {
                            $u.warn(type + " select not found!");
                            return false;
                        }

                        if (type === "Buy") {
                            if (selects.length === 2) {
                                selects.eq(0).val(val);
                            }
                        } else {
                            selects.eq(0).val(val);
                        }

                        return true;
                    } catch (err) {
                        $u.error("ERROR in selectLands: " + err);
                        return false;
                    }
                }

                ss.each(function () {
                    var row          = $j(this),
                        strongs      = $j("strong", row),
                        name         = '',
                        income       = 0,
                        cost         = 0,
                        tStr         = '',
                        maxAllowed   = 0,
                        owned        = 0,
                        s            = 0,
                        roi          = 0,
                        selection    = [1, 5, 10],
                        land         = new caap.landRecord();

                    if (!$u.hasContent(row)) {
                        return true;
                    }

                    selectLands(row, 10);
                    if (!$u.hasContent(strongs) || strongs.length !== 3) {
                        $u.warn("Can't find strongs", strongs.length);
                        return true;
                    }

                    name = strongs.eq(0).text().trim();
                    if (!$u.hasContent(name)) {
                        $u.warn("Can't find land name");
                        return true;
                    }

                    income = strongs.eq(1).text().trim().numberOnly();
                    if (!$u.hasContent(income)) {
                        $u.warn("Can't find land income");
                        return true;
                    }

                    cost = strongs.eq(2).text().trim().numberOnly();
                    if (!$u.hasContent(cost)) {
                        $u.warn("Can't find land cost");
                        return true;
                    }

                    // Lets get our max allowed from the land_buy_info div
                    tStr = row.text().trim().innerTrim();
                    if (!$u.hasContent(tStr)) {
                        $u.warn("Can't find land text");
                        return true;
                    }

                    maxAllowed = tStr.regex(/Max Allowed For your level: (\d+)/);
                    if (!$u.hasContent(maxAllowed)) {
                        $u.warn("Can't find land maxAllowed");
                        return true;
                    }

                    owned = tStr.regex(/Owned: (\d+)/);
                    if (!$u.hasContent(owned)) {
                        $u.warn("Can't find land owned");
                        return true;
                    }

                    land.data['row'] = row;
                    land.data['name'] = name;
                    land.data['income'] = income;
                    land.data['cost'] = cost;
                    land.data['maxAllowed'] = maxAllowed;
                    land.data['owned'] = owned;
                    land.data['buy'] = (maxAllowed - owned) > 10 ? 10 : maxAllowed - owned;
                    land.data['totalCost'] = land.data['buy'] * cost;
                    roi = (((income / cost) * 240000) / 100).dp(2);
                    if (!$u.hasContent($j("input[name='Buy']", row))) {
                        roi = 0;
                        // If we own more than allowed we will set land and selection
                        for (s = 2; s >= 0; s -= 1) {
                            if (land.data['owned'] - land.data['maxAllowed'] >= selection[s]) {
                                caap.sellLand = land.data;
                                selectLands(row, selection[s], 'Sell');
                                break;
                            }
                        }
                    }

                    land.data['roi'] = $u.setContent(roi, 0);
                    strongs.eq(0).text(name + " | " + land.data['roi'] + "% per day.");
                    $u.log(4, "Land:", land.data['name']);
                    if (land.data['roi'] > 0 && land.data['roi'] > caap.bestLand['roi']) {
                        $u.log(4, "Set Land:", land.data['name'], land.data);
                        caap.bestLand = $j.extend(true, {}, land.data);
                    }

                    return true;
                });

                $j.extend(true, bestLandCost, caap.bestLand);
                delete bestLandCost['row'];
                bestLandCost['set'] = true;
                bestLandCost['last'] = new Date().getTime();
                state.setItem('BestLandCost', bestLandCost);
                $u.log(2, "Best Land Cost: ", bestLandCost['name'], bestLandCost['cost'], bestLandCost);
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_land: " + err);
                return false;
            }
        },

        noLandsLog: true,

        lands: function () {
            try {
                if (!config.getItem('autoBuyLand', false)) {
                    return false;
                }

                var bestLandCost = {},
                    cashTotAvail = 0,
                    cashNeed     = 0,
                    theGeneral   = '';

                function buySellLand(land, type) {
                    try {
                        type = type ? type : 'Buy';
                        var button = $j("input[name='" + type + "']", land['row']);
                        if ($u.hasContent(button)) {
                            if (type === 'Buy') {
                                caap.bestLand = state.setItem('BestLandCost', new caap.landRecord().data);
                            } else {
                                caap.sellLand = {};
                            }

                            caap.click(button, 15000);
                            return true;
                        } else {
                            $u.warn(type + " button not found!");
                            return false;
                        }
                    } catch (err) {
                        $u.error("ERROR in buySellLand: " + err);
                        return false;
                    }
                }

                // Do we have lands above our max to sell?
                if (!$j.isEmptyObject(caap.sellLand) && config.getItem('SellLands', false)) {
                    $u.log(2, "Selling land", caap.sellLand['name']);
                    buySellLand(caap.sellLand, 'Sell');
                    return true;
                }

                bestLandCost = state.getItem('BestLandCost', new caap.landRecord().data);
                if (!bestLandCost['set']) {
                    $u.log(2, "Going to land to get Best Land Cost");
                    if (caap.navigateTo('soldiers,land', caap.hasImage('tab_land_on.gif') ? '' : 'tab_land_on.gif')) {
                        return true;
                    }
                }

                if (bestLandCost['cost'] === 0) {
                    if (caap.noLandsLog) {
                        $u.log(2, "No lands to purchase");
                        caap.noLandsLog = false;
                    }

                    return false;
                }

                if (!caap.stats['gold']['bank'] && caap.stats['gold']['bank'] !== 0) {
                    $u.log(2, "Going to keep to get Stored Value");
                    if (caap.navigateTo('keep')) {
                        return true;
                    }
                }

                // Retrieving from Bank
                cashTotAvail = caap.stats['gold']['cash'] + (caap.stats['gold']['bank'] - config.getItem('minInStore', 0));
                cashNeed = bestLandCost['buy'] * bestLandCost['cost'];
                theGeneral = config.getItem('IdleGeneral', 'Use Current');
                if ((cashTotAvail >= cashNeed) && (caap.stats['gold']['cash'] < cashNeed)) {
                    if (theGeneral !== 'Use Current') {
                        $u.log(2, "Changing to idle general");
                        if (general.Select('IdleGeneral')) {
                            return true;
                        }
                    }

                    $u.log(2, "Trying to retrieve", cashNeed - caap.stats['gold']['cash']);
                    return caap.retrieveFromBank(cashNeed - caap.stats['gold']['cash']);
                }

                // Need to check for enough moneys + do we have enough of the builton type that we already own.
                if (bestLandCost['cost'] && caap.stats['gold']['cash'] >= cashNeed) {
                    if (theGeneral !== 'Use Current') {
                        $u.log(2, "Changing to idle general");
                        if (general.Select('IdleGeneral')) {
                            return true;
                        }
                    }

                    caap.navigateTo('soldiers,land');
                    if (caap.hasImage('tab_land_on.gif')) {
                        if (bestLandCost['buy']) {
                            $u.log(2, "Buying land", caap.bestLand['name']);
                            if (buySellLand(caap.bestLand)) {
                                return true;
                            }
                        }
                    } else {
                        return caap.navigateTo('soldiers,land');
                    }
                }

                return false;
            } catch (err) {
                $u.error("ERROR in lands: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        /////////////////////////////////////////////////////////////////////
        //                          CHECKS
        /////////////////////////////////////////////////////////////////////

        checkKeep: function () {
            try {
                if (!schedule.check("keep")) {
                    return false;
                }

                $u.log(2, 'Visiting keep to get stats');
                return caap.navigateTo('keep', 'tab_stats_on.gif');
            } catch (err) {
                $u.error("ERROR in checkKeep: " + err);
                return false;
            }
        },

        checkOracle: function () {
            try {
                if (!schedule.check("oracle")) {
                    return false;
                }

                $u.log(2, "Checking Oracle for Favor Points");
                return caap.navigateTo('oracle', 'oracle_on.gif');
            } catch (err) {
                $u.error("ERROR in checkOracle: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checkBattleRank: function () {
            try {
                if (!schedule.check("battlerank") || caap.stats['level'] < 8) {
                    return false;
                }

                $u.log(2, 'Visiting Battle Rank to get stats');
                return caap.navigateTo('battle,battlerank', 'tab_battle_rank_on.gif');
            } catch (err) {
                $u.error("ERROR in checkBattleRank: " + err);
                return false;
            }
        },

        checkWarRank: function () {
            try {
                if (!schedule.check("warrank") || caap.stats['level'] < 100) {
                    return false;
                }

                $u.log(2, 'Visiting War Rank to get stats');
                return caap.navigateTo('battle,war_rank', 'tab_war_on.gif');
            } catch (err) {
                $u.error("ERROR in CheckWar: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        checkGenerals: function () {
            try {
                if (!schedule.check("generals")) {
                    return false;
                }

                $u.log(2, "Visiting generals to get 'General' list");
                return caap.navigateTo('mercenary,generals', 'tab_generals_on.gif');
            } catch (err) {
                $u.error("ERROR in checkGenerals: " + err);
                return false;
            }
        },

        checkAllGenerals: function () {
            try {
                if (!schedule.check("allGenerals")) {
                    return false;
                }

                return general.GetAllStats();
            } catch (err) {
                $u.error("ERROR in checkAllGenerals: " + err);
                return false;
            }
        },

        checkSoldiers: function () {
            try {
                if (!schedule.check("soldiers")) {
                    return false;
                }

                $u.log(2, "Checking Soldiers");
                return caap.navigateTo('soldiers', 'tab_soldiers_on.gif');
            } catch (err) {
                $u.error("ERROR in checkSoldiers: " + err);
                return false;
            }
        },


        checkItem: function () {
            try {
                if (!schedule.check("item")) {
                    return false;
                }

                $u.log(2, "Checking Item");
                return caap.navigateTo('soldiers,item', 'tab_black_smith_on.gif');
            } catch (err) {
                $u.error("ERROR in checkItem: " + err);
                return false;
            }
        },

        checkMagic: function () {
            try {
                if (!schedule.check("magic")) {
                    return false;
                }

                $u.log(2, "Checking Magic");
                return caap.navigateTo('soldiers,magic', 'tab_magic_on.gif');
            } catch (err) {
                $u.error("ERROR in checkMagic: " + err);
                return false;
            }
        },

        checkAchievements: function () {
            try {
                if (!schedule.check("achievements")) {
                    return false;
                }

                $u.log(2, 'Visiting achievements to get stats');
                return caap.navigateTo('keep,achievements', 'tab_achievements_on.gif');
            } catch (err) {
                $u.error("ERROR in checkAchievements: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checkSymbolQuests: function () {
            try {
                if (!schedule.check("symbolquests") || caap.stats['level'] < 8) {
                    return false;
                }

                $u.log(2, "Visiting symbolquests to get 'Demi-Power' points");
                return caap.navigateTo('quests,symbolquests', 'demi_quest_on.gif');
            } catch (err) {
                $u.error("ERROR in checkSymbolQuests: " + err);
                return false;
            }
        },

        checkCharacterClasses: function () {
            try {
                if (!schedule.check("view_class_progress") || caap.stats['level'] < 100) {
                    return false;
                }

                $u.log(2, "Checking Monster Class to get Character Class Stats");
                return caap.navigateTo('keep,battle_monster,view_class_progress', 'nm_class_whole_progress_bar.jpg');
            } catch (err) {
                $u.error("ERROR in checkCharacterClasses: " + err);
                return false;
            }
        },

        checkArmy: function () {
            try {
                if (!config.getItem("EnableArmy", true) || !schedule.check("army_member")) {
                    return false;
                }

                return army.run();
            } catch (err) {
                $u.error("ERROR in checkArmy: " + err);
                return false;
            }
        },

        /*jslint sub: false */

        checkGift: function () {
            try {
                if (!schedule.check("gift")) {
                    return false;
                }

                $u.log(2, "Checking Gift");
                return caap.navigateTo('army,gift', 'tab_gifts_on.gif');
            } catch (err) {
                $u.error("ERROR in checkGift: " + err);
                return false;
            }
        },

        ajaxCheckFeed: function () {
            try {
                if (!config.getItem('enableMonsterFinder', false) || !config.getItem('feedMonsterFinder', false) || !schedule.check("feedMonsterFinder")) {
                    return false;
                }

                $u.log(2, "Checking Ajax Feed");
                feed.ajaxFeedWait = false;
                feed.ajaxFeed();
                return true;
            } catch (err) {
                $u.error("ERROR in ajaxCheckFeed: " + err);
                return false;
            }
        },

        ajaxCheckGuild: function () {
            try {
                if (!config.getItem('enableMonsterFinder', false) || !config.getItem('guildMonsterFinder', false) || !schedule.check("guildMonsterFinder")) {
                    return false;
                }

                $u.log(2, "Checking Ajax Guild");
                feed.ajaxGuildWait = false;
                feed.ajaxGuild();
                return true;
            } catch (err) {
                $u.error("ERROR in ajaxCheckGuild: " + err);
                return false;
            }
        },

        ajaxCheckPublic1: function () {
            try {
                if (!config.getItem('enableMonsterFinder', false) || !config.getItem('publicMonsterFinder1', false) || !schedule.check("publicMonsterFinder1")) {
                    return false;
                }

                $u.log(2, "Checking Ajax Public Tier 1");
                feed.ajaxPublicWait = false;
                feed.ajaxPublic("1");
                return true;
            } catch (err) {
                $u.error("ERROR in ajaxCheckPublic1: " + err);
                return false;
            }
        },

        ajaxCheckPublic2: function () {
            try {
                if (!config.getItem('enableMonsterFinder', false) || !config.getItem('publicMonsterFinder2', false) || !schedule.check("publicMonsterFinder2")) {
                    return false;
                }

                $u.log(2, "Checking Ajax Public Tier 2");
                feed.ajaxPublicWait = false;
                feed.ajaxPublic("2");
                return true;
            } catch (err) {
                $u.error("ERROR in ajaxCheckPublic2: " + err);
                return false;
            }
        },

        ajaxCheckPublic3: function () {
            try {
                if (!config.getItem('enableMonsterFinder', false) || !config.getItem('publicMonsterFinder3', false) || !schedule.check("publicMonsterFinder3")) {
                    return false;
                }

                $u.log(2, "Checking Ajax Public Tier 3");
                feed.ajaxPublicWait = false;
                feed.ajaxPublic("3");
                return true;
            } catch (err) {
                $u.error("ERROR in ajaxCheckPublic3: " + err);
                return false;
            }
        },

        feedScan: function () {
            try {
                if (!config.getItem('enableMonsterFinder', false) || !config.getItem('feedScan', false) || state.getItem("feedScanDone", false)) {
                    return false;
                }

                $u.log(2, "Doing Feed Scan");
                feed.scan();
                return true;
            } catch (err) {
                $u.error("ERROR in feedScan: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          BATTLING PLAYERS
        /////////////////////////////////////////////////////////////////////

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        battleUserId: function (userid) {
            try {
                if (battle.hashCheck(userid)) {
                    return true;
                }

                var battleButton = null,
                    form         = $j(),
                    inp          = $j();

                battleButton = caap.checkForImage(battle.battles['Freshmeat'][config.getItem('BattleType', 'Invade')]);
                if ($u.hasContent(battleButton)) {
                    form = battleButton.parent().parent();
                    if ($u.hasContent(form)) {
                        inp = $j("input[name='target_id']", form);
                        if ($u.hasContent(inp)) {
                            inp.attr("value", userid);
                            state.setItem("lastBattleID", userid);
                            battle.click(battleButton);
                            state.setItem("notSafeCount", 0);
                            return true;
                        } else {
                            $u.warn("target_id not found in battleForm");
                        }
                    } else {
                        $u.warn("form not found in battleButton");
                    }
                } else {
                    $u.warn("battleButton not found");
                }

                return false;
            } catch (err) {
                $u.error("ERROR in battleUserId: " + err);
                return false;
            }
        },

        battleWarnLevel: true,

        battle: function (mode) {
            try {
                var whenBattle    = '',
                    target        = '',
                    battletype    = '',
                    useGeneral    = '',
                    staminaReq    = 0,
                    chainImg      = '',
                    button        = null,
                    raidName      = '',
                    battleChainId = 0,
                    targetMonster = '',
                    whenMonster   = '',
                    targetType    = '',
                    rejoinSecs    = '',
                    battleRecord  = {},
                    tempTime      = 0,
                    monsterObject = {};

                if (caap.stats['level'] < 8) {
                    if (caap.battleWarnLevel) {
                        $u.log(1, "Battle: Unlock at level 8");
                        caap.battleWarnLevel = false;
                    }

                    return false;
                }

                whenBattle = config.getItem('WhenBattle', 'Never');
                whenMonster = config.getItem('WhenMonster', 'Never');
                targetMonster = state.getItem('targetFrombattle_monster', '');
                monsterObject = $u.hasContent(targetMonster) ? monster.getItem(targetMonster) : monsterObject;
                switch (whenBattle) {
                case 'Never' :
                    caap.setDivContent('battle_mess', 'Battle off');
                    return false;
                case 'Stay Hidden' :
                    if (!caap.needToHide()) {
                        caap.setDivContent('battle_mess', 'We Dont Need To Hide Yet');
                        $u.log(1, 'We Dont Need To Hide Yet');
                        return false;
                    }

                    break;
                case 'No Monster' :
                    if (mode !== 'DemiPoints') {
                        if (whenMonster !== 'Never' && monsterObject && !/the deathrune siege/i.test(monsterObject['name'])) {
                            return false;
                        }
                    }

                    break;
                case 'Demi Points Only' :
                    if (mode === 'DemiPoints' && whenMonster === 'Never') {
                        return false;
                    }

                    if (mode !== 'DemiPoints' && whenMonster !== 'Never' && monsterObject && !/the deathrune siege/i.test(monsterObject['name'])) {
                        return false;
                    }

                    if (battle.selectedDemisDone(true) || (config.getItem("DemiPointsFirst", false) && whenMonster !== 'Never' && config.getItem("observeDemiFirst", false) && state.getItem('DemiPointsDone', false))) {
                        return false;
                    }

                    break;
                default :
                }

                if (caap.checkKeep()) {
                    return true;
                }

                if (caap.stats['health']['num'] < 10) {
                    $u.log(5, 'Health is less than 10: ', caap.stats['health']['num']);
                    return false;
                }

                if (config.getItem("waitSafeHealth", false) && caap.stats['health']['num'] < 13) {
                    $u.log(5, 'Unsafe. Health is less than 13: ', caap.stats['health']['num']);
                    return false;
                }

                target = battle.getTarget(mode);
                $u.log(5, 'Mode/Target', mode, target);
                if (!target) {
                    $u.log(1, 'No valid battle target');
                    return false;
                } else if (!$u.isNumber(target)) {
                    target = target.toLowerCase();
                }

                if (target === 'noraid') {
                    $u.log(5, 'No Raid To Attack');
                    return false;
                }

                battletype = config.getItem('BattleType', 'Invade');
                switch (battletype) {
                case 'Invade' :
                    useGeneral = 'InvadeGeneral';
                    staminaReq = target === 'raid' ? state.getItem('RaidStaminaReq', 1) : 1;
                    chainImg = 'battle_invade_again.gif';
                    if (general.LevelUpCheck(useGeneral)) {
                        useGeneral = 'LevelUpGeneral';
                        $u.log(3, 'Using level up general');
                    }

                    break;
                case 'Duel' :
                    useGeneral = 'DuelGeneral';
                    staminaReq = target === 'raid' ? state.getItem('RaidStaminaReq', 1) : 1;
                    chainImg = 'battle_duel_again.gif';
                    if (general.LevelUpCheck(useGeneral)) {
                        useGeneral = 'LevelUpGeneral';
                        $u.log(3, 'Using level up general');
                    }

                    break;
                case 'War' :
                    useGeneral = 'WarGeneral';
                    staminaReq = 10;
                    chainImg = 'battle_duel_again.gif';
                    if (general.LevelUpCheck(useGeneral)) {
                        useGeneral = 'LevelUpGeneral';
                        $u.log(3, 'Using level up general');
                    }

                    break;
                default :
                    $u.warn('Unknown battle type ', battletype);
                    return false;
                }

                if (!caap.checkStamina('Battle', staminaReq)) {
                    $u.log(3, 'Not enough stamina for ', battletype, staminaReq);
                    return false;
                }

                // Check if we should chain attack
                if ($u.hasContent($j("img[src*='battle_victory.gif']", caap.resultsWrapperDiv))) {
                    button = caap.checkForImage(chainImg);
                    battleChainId = state.getItem("BattleChainId", 0);
                    if ($u.hasContent(button) && battleChainId) {
                        caap.setDivContent('battle_mess', 'Chain Attack In Progress');
                        $u.log(2, 'Chaining Target', battleChainId);
                        battle.click(button);
                        state.setItem("BattleChainId", 0);
                        return true;
                    }

                    state.setItem("BattleChainId", 0);
                }

                if (!state.getItem("notSafeCount", 0)) {
                    state.setItem("notSafeCount", 0);
                }

                $u.log(2, 'Battle Target', target);
                targetType = config.getItem('TargetType', 'Invade');
                switch (target) {
                case 'raid' :
                    if (!schedule.check("RaidNoTargetDelay")) {
                        rejoinSecs = ((schedule.getItem("RaidNoTargetDelay").next - new Date().getTime()) / 1000).dp() + ' secs';
                        $u.log(2, 'Rejoining the raid in', rejoinSecs);
                        caap.setDivContent('battle_mess', 'Joining the Raid in ' + rejoinSecs);
                        return false;
                    }

                    if (general.Select(useGeneral)) {
                        return true;
                    }

                    caap.setDivContent('battle_mess', 'Joining the Raid');
                    // This is a temporary fix for the web3 url until CA fix their HTML
                    if (caap.domain.which === 2 && !$u.hasContent($j("img[src*='tab_raid_']", caap.appBodyDiv))) {
                        if (caap.navigateTo(caap.battlePage, 'battle_on.gif')) {
                            return true;
                        }

                        caap.clickAjaxLinkSend("raid.php");
                        return true;
                    }

                    if (caap.navigateTo(caap.battlePage + ',raid', 'tab_raid_on.gif')) {
                        return true;
                    }

                    if (config.getItem('clearCompleteRaids', false) && $u.hasContent(monster.completeButton['raid']['button']) && $u.hasContent(monster.completeButton['raid']['md5'])) {
                        caap.click(monster.completeButton['raid']['button']);
                        monster.deleteItem(monster.completeButton['raid']['md5']);
                        monster.completeButton['raid'] = {'md5': undefined, 'name': undefined, 'button': undefined};
                        caap.updateDashboard(true);
                        $u.log(1, 'Cleared a completed raid');
                        return true;
                    }

                    raidName = state.getItem('targetFromraid', '');
                    if ($u.hasContent(raidName)) {
                        monsterObject = monster.getItem(raidName);
                    }

                    if (!$u.hasContent($j("div[style*='dragon_title_owner']", caap.appBodyDiv))) {
                        button = monster.engageButtons[monsterObject['md5']];
                        if ($u.hasContent(button)) {
                            caap.click(button);
                            return true;
                        }

                        $u.warn('Unable to engage raid', monsterObject['name']);
                        return false;
                    }

                    if (monster.confirmRightPage(monsterObject['name'])) {
                        return true;
                    }

                    // The user can specify 'raid' in their Userid List to get us here. In that case we need to adjust NextBattleTarget when we are done
                    if (targetType === "Userid List") {
                        if (battle.freshmeat('Raid')) {
                            if ($u.hasContent($j("span[class*='result_body']", caap.appBodyDiv))) {
                                battle.nextTarget();
                            }

                            if (state.getItem("notSafeCount", 0) > 10) {
                                state.setItem("notSafeCount", 0);
                                battle.nextTarget();
                            }

                            return true;
                        }

                        $u.warn('Doing Raid UserID list, but no target');
                        return false;
                    }

                    return battle.freshmeat('Raid');
                case 'freshmeat' :
                    if (general.Select(useGeneral)) {
                        return true;
                    }

                    if (caap.navigateTo(caap.battlePage, 'battle_on.gif')) {
                        return true;
                    }

                    caap.setDivContent('battle_mess', 'Battling ' + target);
                    // The user can specify 'freshmeat' in their Userid List to get us here. In that case we need to adjust NextBattleTarget when we are done
                    if (targetType === "Userid List") {
                        if (battle.freshmeat('Freshmeat')) {
                            if ($u.hasContent($j("span[class*='result_body']", caap.appBodyDiv))) {
                                battle.nextTarget();
                            }

                            if (state.getItem("notSafeCount", 0) > 10) {
                                state.setItem("notSafeCount", 0);
                                battle.nextTarget();
                            }

                            return true;
                        }

                        $u.warn('Doing Freshmeat UserID list, but no target');
                        return false;
                    }

                    return battle.freshmeat('Freshmeat');
                default:
                    if (!config.getItem("IgnoreBattleLoss", false)) {
                        battleRecord = battle.getItem(target);
                        switch (config.getItem("BattleType", 'Invade')) {
                        case 'Invade' :
                            tempTime = battleRecord.invadeLostTime ? battleRecord.invadeLostTime : tempTime;
                            break;
                        case 'Duel' :
                            tempTime = battleRecord.duelLostTime ? battleRecord.duelLostTime : tempTime;
                            break;
                        case 'War' :
                            tempTime = battleRecord.warlostTime ? battleRecord.warlostTime : tempTime;
                            break;
                        default :
                            $u.warn("Battle type unknown!", config.getItem("BattleType", 'Invade'));
                        }

                        if (battleRecord && battleRecord.nameStr !== '' && !schedule.since(tempTime, 604800)) {
                            $u.log(1, 'Avoiding Losing Target', target);
                            battle.nextTarget();
                            return true;
                        }
                    }

                    if (general.Select(useGeneral)) {
                        return true;
                    }

                    if (caap.navigateTo(caap.battlePage, 'battle_on.gif')) {
                        return true;
                    }

                    //state.setItem('BattleChainId', 0);
                    if (caap.battleUserId(target)) {
                        battle.nextTarget();
                        return true;
                    }

                    $u.warn('Doing default UserID list, but no target');
                    return false;
                }
            } catch (err) {
                $u.error("ERROR in battle: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          GUILD
        /////////////////////////////////////////////////////////////////////

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checkResults_guild: function () {
            try {
                // Guild
                var guildTxt   = '',
                    guildDiv   = $j(),
                    tStr       = '',
                    members    = [],
                    save       = false;

                if (config.getItem('enableMonsterFinder', false)) {
                    feed.items("guild");
                }

                schedule.setItem("guildMonsterFinder", config.getItem('CheckGuildMonsterFinderMins', 60) * 60, 300);
                guildTxt = $j("#" + caap.domain.id[caap.domain.which] + "guild_achievement", caap.appBodyDiv).text().trim().innerTrim();
                if ($u.hasContent(guildTxt)) {
                    tStr = guildTxt.regex(/Monster ([\d,]+)/);
                    caap.stats['guild']['mPoints'] = $u.hasContent(tStr) ? ($u.isString(tStr) ? tStr.numberOnly() : tStr) : 0;
                    tStr = guildTxt.regex(/Battle ([\d,]+)/);
                    caap.stats['guild']['bPoints'] = $u.hasContent(tStr) ? ($u.isString(tStr) ? tStr.numberOnly() : tStr) : 0;
                    tStr = guildTxt.regex(/Monster [\d,]+ points \(Top (\d+\-\d+%)\)/);
                    caap.stats['guild']['mRank'] = $u.hasContent(tStr) ? tStr : '';
                    tStr = guildTxt.regex(/Battle [\d,]+ points \(Top (\d+\-\d+%)\)/);
                    caap.stats['guild']['bRank'] = $u.hasContent(tStr) ? tStr : '';
                    save = true;
                } else {
                    $u.warn('Using stored guild Monster and Battle points.');
                }

                guildTxt = $j("#" + caap.domain.id[caap.domain.which] + "guild_blast input[name='guild_id']", caap.globalContainer).attr("value");
                if ($u.hasContent(guildTxt)) {
                    caap.stats['guild']['id'] = guildTxt;
                    save = true;
                } else {
                    $u.warn('Using stored guild_id.');
                }

                guildTxt = $j("#" + caap.domain.id[caap.domain.which] + "guild_banner_section", caap.globalContainer).text().trim();
                if ($u.hasContent(guildTxt)) {
                    caap.stats['guild']['name'] = guildTxt;
                    save = true;
                } else {
                    $u.warn('Using stored guild name.');
                }

                guildDiv = $j("#" + caap.domain.id[caap.domain.which] + "cta_log div[style*='guild_main_score_middle'] a[href*='keep.php?casuser']", caap.globalContainer);
                if ($u.hasContent(guildDiv)) {
                    guildDiv.each(function () {
                        var t = $j(this),
                            uid = t.attr("href").regex(/casuser=(\d+)/),
                            name = t.text().trim();

                        if (uid !== caap.stats['FBID']) {
                            members.push({'userId': uid, 'name': name});
                        }
                    });

                    caap.stats['guild']['members'] = members.slice();
                    save = true;
                } else {
                    $u.warn('Using stored guild member count.');
                }

                $u.log(2, "checkResults_guild", caap.stats['guild']);
                if (save) {
                    caap.saveStats();
                }

                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_guild: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        /////////////////////////////////////////////////////////////////////
        //                          GUILD BATTLES
        /////////////////////////////////////////////////////////////////////

        checkResults_guild_current_battles: function () {
            try {
                var tempDiv = $j();
                tempDiv = $j("img[src*='guild_symbol']");
                if (tempDiv && tempDiv.length) {
                    tempDiv.each(function () {
                        $u.log(5, "name", $j(this).parent().parent().next().text().trim());
                        $u.log(5, "button", $j(this).parent().parent().parent().next().find("input[src*='dragon_list_btn_']"));
                    });
                } else {
                    return false;
                }

                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_guild_current_battles: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          GUILD MONSTERS
        /////////////////////////////////////////////////////////////////////

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        /*-------------------------------------------------------------------------------------\
        GuildMonsterReview is a primary action subroutine to mange the guild monster on the dashboard
        \-------------------------------------------------------------------------------------*/
        guildMonsterReview: function () {
            try {
                /*-------------------------------------------------------------------------------------\
                We do guild monster review once an hour.  Some routines may reset this timer to drive
                GuildMonsterReview immediately.
                \-------------------------------------------------------------------------------------*/
                if (!schedule.check("guildMonsterReview") || config.getItem('WhenGuildMonster', 'Never') === 'Never') {
                    return false;
                }

                if (!caap.stats['guild']['id']) {
                    $u.log(2, "Going to guild to get Guild Id");
                    if (caap.navigateTo('guild')) {
                        return true;
                    }
                }

                var record = {},
                    url    = '',
                    objective = '';

                if (state.getItem('guildMonsterBattlesRefresh', true)) {
                    if (guild_monster.navigate_to_battles_refresh()) {
                        return true;
                    }
                }

                if (!state.getItem('guildMonsterBattlesReview', false)) {
                    if (guild_monster.navigate_to_battles()) {
                        return true;
                    }

                    state.setItem('guildMonsterBattlesReview', true);
                }

                record = guild_monster.getReview();
                if (record && $j.isPlainObject(record) && !$j.isEmptyObject(record)) {
                    $u.log(1, "Reviewing Slot (" + record['slot'] + ") Name: " + record['name']);
                    if (caap.stats['staminaT']['num'] > 0 && config.getItem("doGuildMonsterSiege", true)) {
                        objective = "&action=doObjective";
                    }

                    url = "guild_battle_monster.php?twt2=" + guild_monster.info[record['name']].twt2 + "&guild_id=" + record['guildId'] + objective + "&slot=" + record['slot'] + "&ref=nf";
                    state.setItem('guildMonsterReviewSlot', record['slot']);
                    caap.clickAjaxLinkSend(url);
                    return true;
                }

                schedule.setItem("guildMonsterReview", gm.getItem('guildMonsterReviewMins', 60, hiddenVar) * 60, 300);
                state.setItem('guildMonsterBattlesRefresh', true);
                state.setItem('guildMonsterBattlesReview', false);
                state.setItem('guildMonsterReviewSlot', 0);
                guild_monster.select(true);
                $u.log(1, 'Done with guild monster review.');
                return false;
            } catch (err) {
                $u.error("ERROR in guildMonsterReview: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        checkResults_guild_current_monster_battles: function () {
            try {
                $j("input[src*='dragon_list_btn_']", caap.globalContainer).unbind('click', caap.guildMonsterEngageListener).bind('click', caap.guildMonsterEngageListener);
                guild_monster.populate();

                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_guild_current_monster_battles: " + err);
                return false;
            }
        },

        checkResults_guild_battle_monster: function () {
            try {
                $j("input[src*='guild_duel_button']", caap.globalContainer).unbind('click', caap.guildMonsterEngageListener).bind('click', caap.guildMonsterEngageListener);
                guild_monster.onMonster();
                if (config.getItem("enableTitles", true)) {
                    spreadsheet.doTitles();
                }

                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_guild_battle_monster: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        guildMonster: function () {
            try {
                var when    = '',
                    record  = {},
                    minion  = {},
                    form    = $j(),
                    key     = $j(),
                    url     = '',
                    attack  = 0,
                    stamina = 0;

                when = config.getItem("WhenGuildMonster", 'Never');
                if (when === 'Never') {
                    return false;
                }

                if (!caap.stats['guild']['id']) {
                    $u.log(2, "Going to guild to get Guild Id");
                    if (caap.navigateTo('guild')) {
                        return true;
                    }
                }

                /*
                if (!caap.stats['guild']['id']) {
                    $u.log(2, "Going to keep to get Guild Id");
                    if (caap.navigateTo('keep')) {
                        return true;
                    }
                }
                */

                if (config.getItem('doClassicMonstersFirst', false) && config.getItem("WhenMonster", 'Never') !== 'Never') {
                    if (config.getItem("DemiPointsFirst", false) && !battle.selectedDemisDone()) {
                        return false;
                    }

                    if ((state.getItem('targetFrombattle_monster', '') || state.getItem('targetFromraid', ''))) {
                        return false;
                    }
                }

                if (caap.inLevelUpMode()) {
                    if (caap.stats['staminaT']['num'] < 5) {
                        caap.setDivContent('guild_monster_mess', 'Guild Monster stamina ' + caap.stats['staminaT']['num'] + '/' + 5);
                        return false;
                    }
                } else if (when === 'Stamina Available') {
                    stamina = state.getItem('staminaGuildMonster', 0);
                    if (caap.stats['staminaT']['num'] < stamina) {
                        caap.setDivContent('guild_monster_mess', 'Guild Monster stamina ' + caap.stats['staminaT']['num'] + '/' + stamina);
                        return false;
                    }

                    state.setItem('staminaGuildMonster', 0);
                    record = state.getItem('targetGuildMonster', {});
                    if (record && $j.isPlainObject(record) && !$j.isEmptyObject(record)) {
                        minion = guild_monster.getTargetMinion(record);
                        if (minion && $j.isPlainObject(minion) && !$j.isEmptyObject(minion)) {
                            stamina = guild_monster.getStaminaValue(record, minion);
                            state.setItem('staminaGuildMonster', stamina);
                            if (caap.stats['staminaT']['num'] < stamina) {
                                caap.setDivContent('guild_monster_mess', 'Guild Monster stamina ' + caap.stats['staminaT']['num'] + '/' + stamina);
                                return false;
                            }
                        } else {
                            return false;
                        }
                    } else {
                        return false;
                    }
                } else if (when === 'At X Stamina') {
                    if (caap.stats['staminaT']['num'] >= config.getItem("MaxStaminaToGMonster", 20)) {
                        state.setItem('guildMonsterBattlesBurn', true);
                    }

                    if (caap.stats['staminaT']['num'] <= config.getItem("MinStaminaToGMonster", 0) || caap.stats['staminaT']['num'] < 1) {
                        state.setItem('guildMonsterBattlesBurn', false);
                    }

                    if (!state.getItem('guildMonsterBattlesBurn', false)) {
                        caap.setDivContent('guild_monster_mess', 'Guild Monster stamina ' + caap.stats['staminaT']['num'] + '/' + config.getItem("MaxStaminaToGMonster", 20));
                        return false;
                    }
                } else if (when === 'At Max Stamina') {
                    if (caap.stats['staminaT']['num'] < caap.stats['stamina']['max'] || caap.stats['staminaT']['num'] < 1) {
                        caap.setDivContent('guild_monster_mess', 'Guild Monster stamina ' + caap.stats['staminaT']['num'] + '/' + caap.stats['stamina']['max']);
                        return false;
                    }
                }

                caap.setDivContent('guild_monster_mess', '');
                record = guild_monster.select();
                //record = guild_monster.select(true);
                //record = state.setItem('targetGuildMonster', {});
                //$u.log(1, "record", record);
                if (record && $j.isPlainObject(record) && !$j.isEmptyObject(record)) {
                    if (general.Select('GuildMonsterGeneral')) {
                        return true;
                    }

                    if (!guild_monster.checkPage(record)) {
                        $u.log(2, "Fighting Slot (" + record['slot'] + ") Name: " + record['name']);
                        caap.setDivContent('guild_monster_mess', "Fighting ("  + record['slot'] + ") " + record['name']);
                        url = "guild_battle_monster.php?twt2=" + guild_monster.info[record['name']].twt2 + "&guild_id=" + record['guildId'] + "&slot=" + record['slot'];
                        caap.clickAjaxLinkSend(url);
                        return true;
                    }

                    minion = guild_monster.getTargetMinion(record);
                    if (minion && $j.isPlainObject(minion) && !$j.isEmptyObject(minion)) {
                        $u.log(2, "Fighting target_id (" + minion['target_id'] + ") Name: " + minion['name']);
                        caap.setDivContent('guild_monster_mess', "Fighting (" + minion['target_id'] + ") " + minion['name']);
                        key = $j("#" + caap.domain.id[caap.domain.which] + "attack_key_" + minion['target_id']);
                        if (key && key.length) {
                            attack = guild_monster.getAttackValue(record, minion);
                            if (!attack) {
                                return false;
                            }

                            key.attr("value", attack);
                            form = key.parents("form").eq(0);
                            if (form && form.length) {
                                caap.click(form.find("input[src*='guild_duel_button2.gif'],input[src*='monster_duel_button.gif']"));
                                return true;
                            }
                        }
                    }
                }

                return false;
            } catch (err) {
                $u.error("ERROR in guildMonster: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        /////////////////////////////////////////////////////////////////////
        //                          ARENA
        /////////////////////////////////////////////////////////////////////

        /*checkResults_arena: function () {
            try {
                return arena.checkResults_arena();
            } catch (err) {
                $u.error("ERROR in checkResults_arena: " + err);
                return false;
            }
        },

        checkResults_arena_battle: function () {
            try {
                return arena.checkResults_arena_battle();
            } catch (err) {
                $u.error("ERROR in checkResults_arena_battle: " + err);
                return false;
            }
        },*/

        /*-------------------------------------------------------------------------------------\
        ArenaReview is a primary action subroutine to mange the Arena on the dashboard
        \-------------------------------------------------------------------------------------*/
        /*arenaReview: function () {
            try {
                return arena.review();
            } catch (err) {
                $u.error("ERROR in arenaReview: " + err);
                return false;
            }
        },

        arena: function () {
            try {
                return arena.arena();
            } catch (err) {
                $u.error("ERROR in arena: " + err);
                return false;
            }
        },*/

        /////////////////////////////////////////////////////////////////////
        //                          FESTIVAL
        /////////////////////////////////////////////////////////////////////

        checkResults_festival_battle_home: function () {
            try {
                return festival.checkResults_festival_battle_home();
            } catch (err) {
                $u.error("ERROR in checkResults_festival_battle_home: " + err);
                return false;
            }
        },

        checkResults_festival_guild_battle: function () {
            try {
                return festival.checkResults_festival_guild_battle();
            } catch (err) {
                $u.error("ERROR in checkResults_festival_guild_battle: " + err);
                return false;
            }
        },

        /*-------------------------------------------------------------------------------------\
        FestivalReview is a primary action subroutine to mange the Festival on the dashboard
        \-------------------------------------------------------------------------------------*/
        festivalReview: function () {
            try {
                return festival.review();
            } catch (err) {
                $u.error("ERROR in festivalReview: " + err);
                return false;
            }
        },

        festival: function () {
            try {
                return festival.festival();
            } catch (err) {
                $u.error("ERROR in festival: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          MONSTERS AND BATTLES
        /////////////////////////////////////////////////////////////////////

        checkResults_army_news_feed: function () {
            try {
                if (!config.getItem('enableMonsterFinder', false)) {
                    return true;
                }

                feed.items("feed");
                schedule.setItem("feedMonsterFinder", config.getItem('CheckFeedMonsterFinderMins', 15) * 60, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_army_news_feed: " + err);
                return false;
            }
        },

        checkResults_public_monster_list: function () {
            try {
                if (config.getItem('enableMonsterFinder', false)) {
                    feed.publicItems();
                }

                $j("input[name='Attack Dragon']").click(function () {
                    var form   = $j(this).parents("form").eq(0),
                        userId = $j("input[name='casuser']", form).val().parseInt(),
                        mpool  = $j("input[name='mpool']", form).val().parseInt();

                    state.setItem('clickUrl', caap.domain.link + '/battle_monster.php?casuser=' + userId + '&mpool=' + mpool);
                    schedule.setItem('clickedOnSomething', 0);
                    caap.waitingForDomLoad = true;
                });

                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_public_monster_list: " + err);
                return false;
            }
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checkResults_fightList: function () {
            try {
                if (feed.isScan && $u.hasContent($j("div[style*='no_monster_back.jpg']", caap.appBodyDiv))) {
                    $u.log(2, "No monster");
                    feed.checked(monster.getItem(''));
                    return false;
                }

                var buttonsDiv            = $j("img[src*='dragon_list_btn_'],input[src*='monster_button_']" + (config.getItem("festivalTower", false) ? ",img[src*='festival_monster_']" : ""), caap.appBodyDiv),
                    page                  = '',
                    monsterReviewed       = {},
                    it                    = 0,
                    len                   = 0,
                    url                   = '',
                    siege                 = '',
                    engageButtonName      = '',
                    monsterName           = '',
                    monsterRow            = $j("div[style*='monsterlist_container.gif']", caap.appBodyDiv),
                    monsterFull           = '',
                    monsterInfo           = {},
                    summonDiv             = $j("img[src*='mp_button_summon_']" + (config.getItem("festivalTower", false) ? ",img[src*='festival_monster_summonbtn.gif']" : ""), caap.appBodyDiv),
                    tempText              = '',
                    monsterText           = '',
                    userId                = 0,
                    userName              = '',
                    mName                 = '',
                    md5                   = '',
                    pageUserCheck         = 0,
                    newInputsDiv          = $j();

                monster.clean();
                // get all buttons to check monsterObjectList
                if (!$u.hasContent(summonDiv) && !$u.hasContent(buttonsDiv) && !$u.hasContent(monsterRow)) {
                    $u.log(2, "No buttons found");
                    return false;
                }

                page = state.getItem('page', 'battle_monster');
                if (page === 'player_monster_list') {
                    // Review monsters and find attack and fortify button
                    for (it = 0, len = monsterRow.length; it < len; it += 1) {
                        // Make links for easy clickin'
                        if (!$u.hasContent($j("input", monsterRow.eq(it)))) {
                            $u.log(2, "No inputs found", it);
                            continue;
                        }

                        userId = $u.setContent($j("input[name='casuser']", monsterRow.eq(it)).val(), "0").parseInt();
                        if (!$u.hasContent(userId) || userId === 0) {
                            $u.log(2, "No userId found");
                            continue;
                        }

                        userName = userId === caap.stats['FBID'] ? 'Your' : monsterRow.eq(it).children().eq(1).children().eq(0).text().trim();
                        tempText = $j("img", monsterRow.eq(it)).eq(0).attr("src").basename();
                        monsterText = monster.getListName(tempText);
                        mName = userName + ' ' + monsterText;
                        $u.log(2, "Monster Name", mName);
                        $u.log(3, "checkResults_fightList page", page);
                        md5 = (userId + ' ' + monsterText + ' ' + "battle_monster").toLowerCase().MD5();
                        monsterReviewed = monster.getItem(md5);
                        monsterReviewed['name'] = mName;
                        monsterReviewed['userName'] = userName;
                        monsterReviewed['monster'] = monsterText;
                        monsterReviewed['userId'] = userId;
                        monsterReviewed['md5'] = md5;
                        monsterReviewed['type'] = $u.setContent(monsterReviewed['type'], '');
                        monsterReviewed['page'] = "battle_monster";
                        newInputsDiv = $j("input[name='Attack Dragon']", monsterRow.eq(it));
                        engageButtonName = newInputsDiv.attr("src").regex(/(collect|engage)/);
                        switch (engageButtonName) {
                        case 'collect' :
                            monsterReviewed['status'] = 'Collect Reward';
                            monsterReviewed['color'] = 'grey';
                            break;
                        case 'engage' :
                            monster.engageButtons[monsterReviewed['md5']] = newInputsDiv;
                            break;
                        case 'complete' :
                            if (!$u.hasContent(monster.completeButton["battle_monster"]['md5'])) {
                                monster.completeButton["battle_monster"]['md5'] = $u.setContent(monsterReviewed['md5'], '');
                                monster.completeButton["battle_monster"]['name'] = $u.setContent(monsterReviewed['name'], '');
                                monster.completeButton["battle_monster"]['button'] = $u.setContent($j("img[src*='cancelButton.gif']", monsterRow.eq(it)), null);
                            }

                            monsterReviewed['status'] = 'Complete';
                            monsterReviewed['color'] = 'grey';
                            break;
                        default :
                        }

                        monsterReviewed['hide'] = true;
                        monsterReviewed['mpool'] = $j("input[name='mpool']", monsterRow.eq(it)).val().parseInt();
                        monsterInfo = monster.getInfo(monsterReviewed);
                        siege = monsterInfo && monsterInfo.siege ? "&action=doObjective" : '';
                        monsterReviewed['feedLink'] = "battle_monster.php?casuser=" + monsterReviewed['userId'] + "&mpool=" + monsterReviewed['mpool'];
                        monsterReviewed['link'] = "<a href='" + caap.domain.link + "/" + monsterReviewed['feedLink'] + siege + "'>Link</a>";
                        monsterReviewed['joined'] = true;
                        monster.setItem(monsterReviewed);
                    }
                } else {
                    if ((page === 'battle_monster' || page === 'festival_tower') && !$u.hasContent(buttonsDiv)) {
                        $u.log(2, "No monsters to review");
                        //feed.checked("Not Found");
                        state.setItem('reviewDone', true);
                        return true;
                    }

                    tempText = buttonsDiv.eq(0).parent().attr("href");
                    pageUserCheck = state.getItem('pageUserCheck', 0);
                    if (pageUserCheck && tempText && !(new RegExp('user=' + caap.stats['FBID']).test(tempText) || /alchemy\.php/.test(tempText))) {
                        $u.log(2, "On another player's keep.", pageUserCheck);
                        return false;
                    }

                    // Review monsters and find attack and fortify button
                    for (it = 0, len = buttonsDiv.length; it < len; it += 1) {
                        // Make links for easy clickin'
                        url = buttonsDiv.eq(it).parent().attr("href");
                        if (!(url && /user=/.test(url) && (/mpool=/.test(url) || /raid\.php/.test(url)))) {
                            continue;
                        }

                        url = url.replace(/http(s)*:\/\/(apps\.facebook\.com\/castle_age\/|web3\.castleagegame\.com\/castle_ws\/)/, '');
                        monsterRow = buttonsDiv.eq(it).parents().eq(3);
                        monsterFull = monsterRow.text().trim().innerTrim();
                        monsterName = monsterFull.replace(/Completed!/i, '').replace(/Fled!/i, '').replace(/COLLECTION: \d+:\d+:\d+/i, '').trim().innerTrim();
                        if (/^Your /.test(monsterName)) {
                            monsterText = monsterName.replace(/^Your /, '').trim().innerTrim().toLowerCase().ucWords();
                            userName = "Your";
                        } else if (/Aurelius, Lion's Rebellion/.test(monsterName)) {
                            monsterText = "Aurelius, Lion's Rebellion";
                            userName = monsterName.replace(monsterText, '').trim();
                        } else {
                            monsterText = monsterName.replace(new RegExp(".+'s (.+)$"), '$1');
                            userName = monsterName.replace(monsterText, '').trim();
                            monsterText = monsterText.trim().innerTrim().toLowerCase().ucWords();
                        }

                        tempText = $j("div[style*='.jpg']", monsterRow).eq(0).attr("style").regex(new RegExp(".*\\/(.*\\.jpg)"));
                        monsterText = $u.setContent(monster.getListName(tempText), monsterText);
                        mName = userName + ' ' + monsterText;
                        $u.log(2, "Monster Name", mName);
                        userId = $u.setContent(url.regex(/user=(\d+)/), 0);
                        $u.log(3, "checkResults_fightList page", page.replace(/festival_tower/, "festival_battle_monster"), url);
                        md5 = (userId + ' ' + monsterText + ' ' + page.replace(/festival_tower/, "festival_battle_monster")).toLowerCase().MD5();
                        monsterReviewed = monster.getItem(md5);
                        monsterReviewed['name'] = mName;
                        monsterReviewed['userName'] = userName;
                        monsterReviewed['monster'] = monsterText;
                        monsterReviewed['userId'] = userId;
                        monsterReviewed['md5'] = md5;
                        monsterReviewed['type'] = $u.setContent(monsterReviewed['type'], '');
                        monsterReviewed['page'] = page.replace(/festival_tower/, "festival_battle_monster");
                        engageButtonName = page === 'festival_tower' ? $u.setContent(buttonsDiv.eq(it).attr("src"), '').regex(/festival_monster_(\S+)\.gif/i) : $u.setContent(buttonsDiv.eq(it).attr("src"), '').regex(/(dragon_list_btn_\d)/i);
                        switch (engageButtonName) {
                        case 'collectbtn' :
                        case 'dragon_list_btn_2' :
                            monsterReviewed['status'] = 'Collect Reward';
                            monsterReviewed['color'] = 'grey';
                            break;
                        case 'engagebtn' :
                        case 'dragon_list_btn_3' :
                            monster.engageButtons[monsterReviewed['md5']] = $j(buttonsDiv.eq(it));
                            break;
                        case 'viewbtn' :
                        case 'dragon_list_btn_4' :
                            if (page === 'raid' && !(/!/.test(monsterFull))) {
                                monster.engageButtons[monsterReviewed['md5']] = $j(buttonsDiv.eq(it));
                                break;
                            }

                            if (page !== "festival_tower" && !$u.hasContent(monster.completeButton[page.replace("festival_tower", "battle_monster")]['button']) || !$u.hasContent(monster.completeButton[page.replace("festival_tower", "battle_monster")]['md5'])) {
                                monster.completeButton[page.replace("festival_tower", "battle_monster")]['md5'] = $u.setContent(monsterReviewed['md5'], '');
                                monster.completeButton[page.replace("festival_tower", "battle_monster")]['name'] = $u.setContent(monsterReviewed['name'], '');
                                monster.completeButton[page.replace("festival_tower", "battle_monster")]['button'] = $u.setContent($j("img[src*='cancelButton.gif']", monsterRow), null);
                            }

                            monsterReviewed['status'] = 'Complete';
                            monsterReviewed['color'] = 'grey';
                            break;
                        default :
                        }

                        monsterReviewed['hide'] = true;
                        monsterReviewed['mpool'] = /mpool=\d+/.test(url) ? '&mpool=' + url.regex(/mpool=(\d+)/) : '';
                        monsterReviewed['mid'] = /mid=\S+/.test(url) ? '&mid=' + url.regex(/mid=(\S+)[&]*/) : '';
                        monsterInfo = monster.getInfo(monsterReviewed);
                        siege = monsterInfo && monsterInfo.siege ? "&action=doObjective" : '';
                        monsterReviewed['feedLink'] = url;
                        //monsterReviewed['link'] = "<a href='" + caap.domain.link + "/" + (page === 'festival_tower' ? 'festival_battle_monster' : page) + ".php?casuser=" + monsterReviewed['userId'] + monsterReviewed['mpool'] + $u.setContent(monsterReviewed['mid'], '') + siege + "'>Link</a>";
                        monsterReviewed['link'] = "<a href='" + caap.domain.link + "/" + monsterReviewed['feedLink'] + siege + "'>Link</a>";
                        monsterReviewed['joined'] = true;
                        monster.setItem(monsterReviewed);
                    }
                }

                state.setItem('reviewDone', true);
                caap.updateDashboard(true);
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_fightList: " + err);
                return false;
            }
        },

        checkResults_viewFight: function () {
            try {
                var currentMonster    = {},
                    time              = [],
                    tempDiv           = $j(),
                    tempText          = '',
                    tempArr           = [],
                    counter           = 0,
                    monstHealthImg    = '',
                    totalCount        = 0,
                    ind               = 0,
                    len               = 0,
                    searchStr         = '',
                    searchRes         = $j(),
                    achLevel          = 0,
                    maxDamage         = 0,
                    maxToFortify      = 0,
                    isTarget          = false,
                    KOBenable         = false,
                    KOBbiasHours      = 0,
                    KOBach            = false,
                    KOBmax            = false,
                    KOBminFort        = false,
                    KOBtmp            = 0,
                    KOBtimeLeft       = 0,
                    KOBbiasedTF       = 0,
                    KOBPercentTimeRemaining = 0,
                    KOBtotalMonsterTime = 0,
                    monsterDiv        = $j("div[style*='dragon_title_owner'],div[style*='monster_header_']" + (config.getItem("festivalTower", false) ? ",div[style*='festival_monsters_top_']" : ""), caap.appBodyDiv),
                    actionDiv         = $j(),
                    damageDiv         = $j(),
                    monsterInfo       = {},
                    targetFromfortify = {},
                    tStr              = '',
                    tNum              = 0,
                    tBool             = false,
                    fMonstStyle       = '',
                    nMonstStyle       = '',
                    id                = 0,
                    userName          = '',
                    mName             = '',
                    feedMonster       = '',
                    md5               = '',
                    //page              = state.getItem('page', 'battle_monster'),
                    page              = $j(".game", caap.globalContainer).eq(0).attr("id").replace(caap.domain.id[caap.domain.which], ''),
                    matches           = true,
                    ctaDiv            = $j(),
                    dragonDiv         = $j(".dragonContainer", caap.appBodyDiv),
                    dleadersDiv       = $j("td:eq(1) div[style*='bold']:eq(0) div:last", dragonDiv),
                    maxJoin           = dleadersDiv.text().regex(/(\d+)/),
                    countJoin         = 0,
                    it                = 0,
                    jt                = 0,
                    groups            = {},
                    groupMatch        = false;

                $u.log(3, "Damage Leaders", dleadersDiv.text(), maxJoin);
                tempDiv = $j("td[colspan='2']", dragonDiv);
                if ($u.hasContent(tempDiv)) {
                    tempDiv.each(function (index) {
                        $j(this).parent().attr("id", "mark" + index);
                    });

                    tempDiv.each(function (index) {
                        var group  = $j(this),
                            levels = $j("b", group).text(),
                            start  = levels.regex(/Levels (\d+)/),
                            max    = group.text().trim().innerTrim().replace(levels, '').trim(),
                            maxNum = max.regex(/(\d+)/),
                            adjust = group.parent().siblings("#mark" + (index + 1)).length ? 1 : 0,
                            count  = group.parent().nextUntil("#mark" + (index + 1)).length - adjust;

                        $u.log(3, "groups", index, levels, start, maxNum, count);
                        groups[levels] = {'level': start, 'max': maxNum, 'count': count};
                        countJoin += count;
                        if (!feed.isScan) {
                            group.html("<div><b>" + levels + "</b> [" + count + "/" + maxNum + " max]</div>");
                        }
                    });
                } else {
                    tempDiv = $j("table:eq(1) a", dragonDiv);
                    countJoin = tempDiv.length;
                }

                groups['total'] = {'max': maxJoin, 'count': countJoin};
                $u.log(3, "groups", groups);
                if (!feed.isScan) {
                    dleadersDiv.html("[" + countJoin + "/" + maxJoin + "max]");
                }

                if (feed.isScan && $u.hasContent(feed.scanRecord['page']) && feed.scanRecord['page'] !== page) {
                    page = feed.scanRecord['page'];
                    $u.log(2, "Page mismatch so using feed.scanRecord page", page, feed.scanRecord['page']);
                    if (config.getItem("DebugLevel", 1) > 1) {
                        $j().alert("Page mismatch so using feed.scanRecord page<br />" + page + '<br />' + feed.scanRecord['page']);
                    }
                }

                $u.log(3, "GAME PAGE", page);
                if (!feed.isScan) {
                    battle.checkResults();
                    if (config.getItem("enableTitles", true)) {
                        spreadsheet.doTitles();
                    }

                    caap.chatLink(caap.appBodyDiv, "#" + caap.domain.id[caap.domain.which] + "chat_log div[style*='hidden'] div[style*='320px']");
                }

                $u.log(4, "monsterDiv", monsterDiv);
                if ($u.hasContent(monsterDiv)) {
                    fMonstStyle = monsterDiv.attr("style").regex(/(festival_monsters_top_\S+\.jpg)/);
                    $u.log(3, "fMonstStyle", fMonstStyle);
                    if ($u.hasContent(fMonstStyle)) {
                        tempText = $u.setContent(monsterDiv.children(":eq(3)").text(), '').trim().innerTrim().replace(/summoned/i, monster.getFestName(fMonstStyle));
                    } else {
                        nMonstStyle = monsterDiv.attr("style").regex(/(monster_header_\S+\.jpg)/);
                        $u.log(3, "nMonstStyle", nMonstStyle);
                        if ($u.hasContent(nMonstStyle)) {
                            tempText = $u.setContent(monsterDiv.children(":eq(1)").children(":eq(1)").text(), '').trim().innerTrim().replace(/ summoned/i, "'s " + monster.getNewName(nMonstStyle));
                        } else {
                            tempText = $u.setContent(monsterDiv.children(":eq(2)").text(), '').trim().innerTrim();
                        }
                    }

                    $u.log(3, "tempText", tempText);
                } else {
                    monsterDiv = $j("div[style*='nm_top']", caap.appBodyDiv);
                    if ($u.hasContent(monsterDiv)) {
                        tempText = $u.setContent(monsterDiv.children(":eq(0)").children(":eq(0)").text(), '').trim().innerTrim();
                        tempDiv = $j("div[style*='nm_bars']", caap.appBodyDiv);
                        if ($u.hasContent(tempDiv)) {
                            tempText += ' ' + $u.setContent(tempDiv.children(":eq(0)").children(":eq(0)").children(":eq(0)").siblings(":last").children(":eq(0)").text(), '').trim().replace("'s Life", "");
                        } else {
                            $u.warn("Problem finding nm_bars");
                            return;
                        }
                    } else {
                        if ($u.hasContent(fMonstStyle)) {
                            $j().alert(fMonstStyle + "<br />I don't know this monster!<br />Please inform me.");
                        }

                        if ($u.hasContent($j("div[style*='no_monster_back.jpg']", caap.appBodyDiv))) {
                            $u.log(2, "No monster");
                        }  else {
                            $u.warn("Problem finding dragon_title_owner and nm_top");
                        }

                        feed.checked(monster.getItem(''));
                        return;
                    }
                }

                if ($u.hasContent(monsterDiv)) {
                    id = $u.setContent($j("img[src*='profile.ak.fbcdn.net']", monsterDiv).attr("uid"), '').regex(/(\d+)/);
                    id = $u.setContent(id, $u.setContent($j(".fb_link[href*='profile.php']", monsterDiv).attr("href"), '').regex(/id=(\d+)/));
                    id = $u.setContent(id, $u.setContent($j("img[src*='graph.facebook.com']", monsterDiv).attr("src"), '').regex(/\/(\d+)\//));
                    id = $u.setContent(id, $u.setContent($j("button[onclick*='ajaxSectionUpdate']", caap.appBodyDiv).attr("onclick") + "", '').regex(/user=(\d+)/));
                    id = $u.setContent(id, feed.isScan ? feed.scanRecord['id'] : 0);
                    $u.log(3, "USER ID", id);
                    if (id === 0 || !$u.hasContent(id)) {
                        $u.warn("Unable to get id!");
                        if (config.getItem("DebugLevel", 1) > 1) {
                            $j().alert("Unable to get id!");
                        }

                        if (feed.isScan) {
                            feed.checked(monster.getItem(''));
                        }

                        return;
                    }

                    if (/Aurelius, Lion's Rebellion/.test(tempText)) {
                        feedMonster = "Aurelius, Lion's Rebellion";
                        userName = tempText.replace(feedMonster, '').trim();
                    } else {
                        feedMonster = tempText.replace(new RegExp(".+'s (.+)$"), '$1');
                        userName = tempText.replace(feedMonster, '').trim();
                        feedMonster = feedMonster.trim().innerTrim().toLowerCase().ucWords();
                    }

                    if (!$u.hasContent(feedMonster)) {
                        $u.warn("Unable to get monster string!!");
                    }

                    if (id === caap.stats['FBID']) {
                        $u.log(2, "Your monster found", tempText);
                        userName = 'Your';
                    }
                } else {
                    $u.warn("checkResults_viewFight monsterDiv issue!");
                }

                mName = userName + ' ' + feedMonster;
                $u.log(2, "Monster name", mName);
                if (feed.isScan) {
                    if (feed.scanRecord['id'] !== id) {
                        $u.warn("User ID doesn't match!");
                        if (config.getItem("DebugLevel", 1) > 1) {
                            $j().alert("User ID doesn't match!<br />" + id + '<br />' + feed.scanRecord['id']);
                        }

                        matches = false;
                    }

                    if (feed.scanRecord['monster'] !== feedMonster) {
                        $u.warn("Monster doesn't match!");
                        if (config.getItem("DebugLevel", 1) > 1) {
                            $j().alert("Monster doesn't match!<br />" + feed.scanRecord['monster'] + '<br />' + feedMonster);
                        }

                        matches = false;
                    }

                    if (!feed.scanRecord['url'].hasIndexOf(page)) {
                        $u.warn("Page doesn't match!");
                        if (config.getItem("DebugLevel", 1) > 1) {
                            $j().alert("Page doesn't match!<br />" + page + '<br />' + feed.scanRecord['url']);
                        }

                        matches = false;
                    }

                    if (!matches) {
                        feed.checked(monster.getItem(''));
                    }
                }

                md5 = (id + ' ' + feedMonster + ' ' + page).toLowerCase().MD5();
                if (feed.isScan && matches && feed.scanRecord['md5'] !== md5) {
                    $u.warn("MD5 mismatch!", md5, feed.scanRecord['md5']);
                    if (config.getItem("DebugLevel", 1) > 1) {
                        $j().alert("md5 mismatch!<br />" + md5 + '<br />' + feed.scanRecord['md5']);
                    }

                    throw "MD5 mismatch!";
                }

                currentMonster = monster.getItem(md5);
                currentMonster['save'] = true;
                if ((!$u.hasContent(currentMonster['userId']) || currentMonster['userId'] === 0) && $u.hasContent(id) && id !== 0) {
                    currentMonster['userId'] = id;
                    $u.log(3, "Set monster id", currentMonster['userId']);
                }

                if (!$u.hasContent(currentMonster['name']) && $u.hasContent(mName)) {
                    currentMonster['name'] = mName;
                    $u.log(3, "Set monster name", currentMonster['name']);
                }

                if (!$u.hasContent(currentMonster['monster']) && $u.hasContent(feedMonster)) {
                    currentMonster['monster'] = feedMonster;
                    $u.log(3, "Set monster monster", currentMonster['monster']);
                }

                if (!$u.hasContent(currentMonster['userName']) && $u.hasContent(userName)) {
                    currentMonster['userName'] = userName;
                    $u.log(3, "Set monster userName", userName);
                }

                if (!$u.hasContent(currentMonster['md5'])) {
                    currentMonster['md5'] = md5;
                    $u.log(3, "Set monster md5", currentMonster['md5']);
                }

                if (!$u.hasContent(currentMonster['page']) && $u.hasContent(page)) {
                    currentMonster['page'] = page;
                    $u.log(3, "Set monster page", page);
                }

                if (!$u.hasContent(currentMonster['feedLink'])) {
                    if (feed.isScan) {
                        currentMonster['save'] = false;
                        currentMonster['feedLink'] = feed.scanRecord['url'];
                        $u.log(3, "Set monster feedLink ajax", currentMonster['feedLink']);
                    } else {
                        feed.scanRecord = feed.getItem(md5);
                        if (feed.scanRecord) {
                            currentMonster['feedLink'] = feed.scanRecord['url'];
                            $u.log(3, "Set monster feedLink from feed.scanRecord", currentMonster['feedLink']);
                        } else {
                            currentMonster['feedLink'] = page + '.php?';
                            currentMonster['feedLink'] += page !== 'festival_battle_monster' ? 'twt2&' : '';
                            currentMonster['feedLink'] += 'causer=' + id;
                            ctaDiv = $j("input[name*='help with']", caap.appBodyDiv).parents("form").eq(0);
                            tStr = $j("input[name='mpool']", ctaDiv).attr("value");
                            currentMonster['feedLink'] += $u.hasContent(tStr) ? '&mpool=' + tStr.parseInt() : '';
                            tStr = $j("input[name='mid']", ctaDiv).attr("value");
                            currentMonster['feedLink'] += $u.hasContent(tStr) ? '&mid=' + tStr : '';
                            $u.log(2, "Set monster feedLink", currentMonster['feedLink']);
                            if (config.getItem("DebugLevel", 1) > 1) {
                                $j().alert("Set monster feedLink<br />" + currentMonster['feedLink']);
                            }
                        }
                    }
                }

                if ($u.hasContent(currentMonster['feedLink'])) {
                    tNum = currentMonster['feedLink'].regex(/mpool=(\d+)/);
                    currentMonster['mpool'] = $u.hasContent(tNum) ? '&mpool=' + tNum : '';
                    tStr = currentMonster['feedLink'].regex(/mid=(\S+)[&]*/);
                    currentMonster['mid'] = $u.hasContent(tStr) ? '&mid=' + tStr : '';
                    tNum = currentMonster['feedLink'].regex(/rix=(\d+)/);
                    currentMonster['rix'] = $u.hasContent(tNum) ? tNum : -1;
                }

                currentMonster['hide'] = false;
                currentMonster['fImg'] = $u.setContent(fMonstStyle, '');
                currentMonster['type'] = $u.setContent(currentMonster['type'], '');
                monsterInfo = monster.getInfo(currentMonster);
                $u.log(2, "monsterInfo", currentMonster['monster'], monsterInfo);
                if ($u.hasContent(monsterInfo.levels)) {
                    for (it = 0; it < monsterInfo.levels.length; it += 1) {
                        groupMatch = false;
                        for (jt in groups) {
                            if (groups.hasOwnProperty(jt)) {
                                if (groups[jt]['level'] === monsterInfo.levels[it]) {
                                    currentMonster['joinable']['group' + it] = groups[jt];
                                    groupMatch = true;
                                }
                            }
                        }

                        if (!groupMatch) {
                            currentMonster['joinable']['group' + it] = {'level': monsterInfo.levels[it], 'max': monsterInfo.join[it], 'count': 0};
                        }
                    }
                }

                currentMonster['joinable']['total'] = groups['total'];
                $u.log(3, "Joinable", currentMonster['joinable']);
                if (currentMonster['monster'] === 'The Deathrune Siege') {
                    tempDiv = $j("div[style*='raid_back']", caap.appBodyDiv);
                    if ($u.hasContent(tempDiv)) {
                        if ($u.hasContent($j("img[src*='raid_1_large.jpg']", tempDiv))) {
                            currentMonster['type'] = 'Raid I';
                        } else if ($u.hasContent($j("img[src*='raid_b1_large.jpg']", tempDiv))) {
                            currentMonster['type'] = 'Raid II';
                        } else if ($u.hasContent($j("img[src*='raid_1_large_victory.jpg']", tempDiv))) {
                            $u.log(2, "Siege Victory!");
                            currentMonster['hide'] = true;
                            currentMonster['joinable'] = {};
                        } else {
                            $u.log(2, "Problem finding raid image! Probably finished.");
                            currentMonster['hide'] = true;
                            currentMonster['joinable'] = {};
                        }

                        $u.log(2, "Raid Type", currentMonster['type']);
                    } else {
                        $u.warn("Problem finding raid_back");
                        return;
                    }
                }

                currentMonster['review'] = new Date().getTime();
                state.setItem('monsterRepeatCount', 0);
                // Extract info
                tempDiv = $j("#" + caap.domain.id[caap.domain.which] + "monsterTicker", caap.appBodyDiv);
                if ($u.hasContent(tempDiv)) {
                    $u.log(4, "Monster ticker found");
                    time = $u.setContent(tempDiv.text(), '').regex(/(\d+):(\d+):(\d+)/);
                } else {
                    if (caap.hasImage("dead.jpg")) {
                        currentMonster['hide'] = true;
                        currentMonster['joinable'] = {};
                    } else {
                        $u.warn("Could not locate Monster ticker.");
                    }
                }

                if ($u.hasContent(time) && time.length === 3 && monsterInfo && monsterInfo.fort) {
                    currentMonster['fortify'] = currentMonster['type'] === "Deathrune" || currentMonster['type'] === 'Ice Elemental' ? 100 : 0;
                    switch (monsterInfo.defense_img) {
                    case 'bar_dispel.gif' :
                        tempDiv = $j("img[src*='" + monsterInfo.defense_img + "']", caap.appBodyDiv).parent();
                        if ($u.hasContent(tempDiv)) {
                            currentMonster['fortify'] = (100 - tempDiv.getPercent('width')).dp(2);
                        } else {
                            currentMonster['fortify'] = 100;
                            $u.warn("Unable to find defense bar", monsterInfo.defense_img);
                        }

                        break;
                    case 'seamonster_ship_health.jpg' :
                        tempDiv = $j("img[src*='" + monsterInfo.defense_img + "']", caap.appBodyDiv).parent();
                        if ($u.hasContent(tempDiv)) {
                            currentMonster['fortify'] = tempDiv.getPercent('width').dp(2);
                            if (monsterInfo.repair_img) {
                                tempDiv = $j("img[src*='" + monsterInfo.repair_img + "']", caap.appBodyDiv).parent();
                                if ($u.hasContent(tempDiv)) {
                                    currentMonster['fortify'] = (currentMonster['fortify'] * (100 / (100 - tempDiv.getPercent('width')))).dp(2);
                                } else {
                                    currentMonster['fortify'] = 100;
                                    $u.warn("Unable to find repair bar", monsterInfo.repair_img);
                                }
                            }
                        } else {
                            currentMonster['fortify'] = 100;
                            $u.warn("Unable to find defense bar", monsterInfo.defense_img);
                        }

                        break;
                    case 'nm_green.jpg' :
                        tempDiv = $j("img[src*='" + monsterInfo.defense_img + "']", caap.appBodyDiv).parent();
                        if ($u.hasContent(tempDiv)) {
                            currentMonster['fortify'] = tempDiv.getPercent('width').dp(2);
                            tempDiv = tempDiv.parent();
                            if ($u.hasContent(tempDiv)) {
                                currentMonster['strength'] = tempDiv.getPercent('width').dp(2);
                            } else {
                                currentMonster['strength'] = 100;
                                $u.warn("Unable to find defense bar strength");
                            }
                        } else {
                            currentMonster['fortify'] = 100;
                            currentMonster['strength'] = 100;
                            $u.warn("Unable to find defense bar fortify");
                        }

                        break;
                    default:
                        $u.warn("No match for defense_img", monsterInfo.defense_img);
                    }
                }

                // Get damage done to monster
                actionDiv = $j("#" + caap.domain.id[caap.domain.which] + "action_logs", caap.appBodyDiv);
                damageDiv = $j("td[class='dragonContainer']:first td[valign='top']:first a[href*='user=" + caap.stats['FBID'] + "']:first", actionDiv);
                if ($u.hasContent(damageDiv)) {
                    if (monsterInfo && monsterInfo.defense) {
                        tempArr = $u.setContent(damageDiv.parent().parent().siblings(":last").text(), '').trim().innerTrim().regex(/([\d,]+ dmg) \/ ([\d,]+ def)/);
                        if ($u.hasContent(tempArr) && tempArr.length === 2) {
                            currentMonster['attacked'] = $u.setContent(tempArr[0], '0').numberOnly();
                            currentMonster['defended'] = $u.setContent(tempArr[1], '0').numberOnly();
                            currentMonster['damage'] = currentMonster['attacked'] + currentMonster['defended'];
                        } else {
                            $u.warn("Unable to get attacked and defended damage");
                        }
                    } else if (currentMonster['monster'] === 'The Deathrune Siege') {
                        currentMonster['attacked'] = $u.setContent(damageDiv.parent().siblings(":last").text(), '0').numberOnly();
                        currentMonster['damage'] = currentMonster['attacked'];
                    } else {
                        currentMonster['attacked'] = $u.setContent(damageDiv.parent().parent().siblings(":last").text(), '0').numberOnly();
                        currentMonster['damage'] = currentMonster['attacked'];
                    }

                    if (!feed.isScan) {
                        damageDiv.parents("tr").eq(0).css('background-color', gm.getItem("HighlightColor", '#C6A56F', hiddenVar));
                    }

                    currentMonster['hide'] = true;
                } else {
                    currentMonster['hide'] = !$u.hasContent($j("input[name='Attack Dragon'],input[name='raid_btn']", caap.appBodyDiv));
                    $u.log(2, "Player hasn't done damage yet");
                }

                tBool = currentMonster['monster'] === "The Deathrune Siege" ? true : false;
                if (/:ac\b/.test(currentMonster['conditions']) || (tBool && config.getItem('raidCollectReward', false)) || (!tBool && config.getItem('monsterCollectReward', false))) {
                    counter = state.getItem('monsterReviewCounter', config.getItem("festivalTower", false) ? -4 : -3);
                    // Change from using monster name to monster MD5 - need to keep an eye open for any more
                    if (counter >= 0 && monster.records[counter] && monster.records[counter]['md5'] === currentMonster['md5'] && ($u.hasContent($j("a[href*='&action=collectReward']", caap.appBodyDiv)) || $u.hasContent($j("input[alt*='Collect Reward']", caap.appBodyDiv)))) {
                        $u.log(2, 'Collecting Reward');
                        currentMonster['review'] = -1;
                        state.setItem('monsterReviewCounter', counter -= 1);
                        currentMonster['status'] = 'Collect Reward';
                        currentMonster['rix'] = currentMonster['monster'] === "The Deathrune Siege" ? $u.setContent($u.setContent($j("a[href*='&rix=']", caap.appBodyDiv).attr("href"), '').regex(/&rix=(\d+)/), -1) : -1;
                    }
                }

                monstHealthImg = monsterInfo && monsterInfo.alpha ? 'nm_red.jpg' :  'monster_health_background.jpg';
                monsterDiv = $j("img[src*='" + monstHealthImg + "']", caap.appBodyDiv).parent();
                if ($u.hasContent(time) && time.length === 3 && $u.hasContent(monsterDiv)) {
                    currentMonster['time'] = time;
                    if ($u.hasContent(monsterDiv)) {
                        $u.log(4, "Found monster health div");
                        currentMonster['life'] = monsterDiv.getPercent('width').dp(2);
                        if (!feed.isScan) {
                            tempDiv = monsterDiv.siblings().eq(0).children().eq(0);
                            $u.log(2, "1st", tempDiv);
                            if (!$u.hasContent(tempDiv)) {
                                tempDiv = monsterDiv.parent().parent().siblings().eq(0);
                                $u.log(2, "2nd", tempDiv);

                                if ($u.hasContent(tempDiv.children())) {
                                    tempDiv = tempDiv.children().eq(0);
                                    $u.log(2, "3rd", tempDiv);
                                }
                            }

                            tempText = tempDiv.text().trim();
                            if (!$u.hasContent(tempDiv.children()) && tempText.toLowerCase().hasIndexOf('life')) {
                                tempDiv.text(tempText + " (" + currentMonster['life'] + "%)");
                            }
                        }
                    } else {
                        $u.warn("Could not find monster health div.");
                    }

                    if (currentMonster['life'] && !monsterInfo) {
                        monster.setItem(currentMonster);
                        $u.warn('Unknown monster', currentMonster);
                        return;
                    }

                    if ($u.hasContent(damageDiv) && monsterInfo && monsterInfo.alpha) {
                        // Character type stuff
                        monsterDiv = $j("div[style*='nm_bottom']", caap.appBodyDiv);
                        if ($u.hasContent(monsterDiv)) {
                            tempText = $u.setContent(monsterDiv.children().eq(0).children().text(), '').trim().innerTrim();
                            if (tempText) {
                                $u.log(4, "Character class text", tempText);
                                tStr = tempText.regex(/Class: (\w+) /);
                                if ($u.hasContent(tStr)) {
                                    currentMonster['charClass'] = tStr;
                                    $u.log(4, "character", currentMonster['charClass']);
                                } else {
                                    $u.warn("Can't get character", tempText);
                                }

                                tStr = tempText.regex(/Tip: ([\w ]+) Status/);
                                if ($u.hasContent(tStr)) {
                                    currentMonster['tip'] = tStr;
                                    $u.log(4, "tip", currentMonster['tip']);
                                } else {
                                    $u.warn("Can't get tip", tempText);
                                }

                                tempArr = tempText.regex(/Status Time Remaining: (\d+):(\d+):(\d+)\s*/);
                                if ($u.hasContent(tempArr) && tempArr.length === 3) {
                                    currentMonster['stunTime'] = new Date().getTime() + (tempArr[0] * 60 * 60 * 1000) + (tempArr[1] * 60 * 1000) + (tempArr[2] * 1000);
                                    $u.log(4, "statusTime", currentMonster['stunTime']);
                                } else {
                                    $u.warn("Can't get statusTime", tempText);
                                }

                                tempDiv = $j("img[src*='nm_stun_bar']", monsterDiv);
                                if ($u.hasContent(tempDiv)) {
                                    tempText = tempDiv.getPercent('width').dp(2);
                                    $u.log(4, "Stun bar percent text", tempText);
                                    if (tempText >= 0) {
                                        currentMonster['stun'] = tempText;
                                        $u.log(4, "stun", currentMonster['stun']);
                                    } else {
                                        $u.warn("Can't get stun bar width");
                                    }
                                } else {
                                    tempArr = currentMonster['tip'].split(" ");
                                    if ($u.hasContent(tempArr)) {
                                        tempText = tempArr[tempArr.length - 1].toLowerCase();
                                        tempArr = ["strengthen", "heal"];
                                        if (tempText && tempArr.hasIndexOf(tempText)) {
                                            if (tempText === tempArr[0]) {
                                                currentMonster['stun'] = currentMonster['strength'];
                                            } else if (tempText === tempArr[1]) {
                                                currentMonster['stun'] = currentMonster['health'];
                                            } else {
                                                $u.warn("Expected strengthen or heal to match!", tempText);
                                            }
                                        } else {
                                            $u.warn("Expected strengthen or heal from tip!", tempText);
                                        }
                                    } else {
                                        $u.warn("Can't get stun bar and unexpected tip!", currentMonster['tip']);
                                    }
                                }

                                if (currentMonster['charClass'] && currentMonster['tip'] && currentMonster['stun'] !== -1) {
                                    currentMonster['stunDo'] = new RegExp(currentMonster['charClass']).test(currentMonster['tip']) && currentMonster['stun'] < 100;
                                    currentMonster['stunType'] = '';
                                    if (currentMonster['stunDo']) {
                                        $u.log(2, "Do character specific attack", currentMonster['stunDo']);
                                        tempArr = currentMonster['tip'].split(" ");
                                        if ($u.hasContent(tempArr)) {
                                            tempText = tempArr[tempArr.length - 1].toLowerCase();
                                            tempArr = ["strengthen", "cripple", "heal", "deflection"];
                                            if (tempText && tempArr.hasIndexOf(tempText)) {
                                                currentMonster['stunType'] = tempText.replace("ion", '');
                                                $u.log(2, "Character specific attack type", currentMonster['stunType']);
                                            } else {
                                                $u.warn("Type does match list!", tempText);
                                            }
                                        } else {
                                            $u.warn("Unable to get type from tip!", currentMonster);
                                        }
                                    } else {
                                        $u.log(3, "Tip does not match class or stun maxed", currentMonster);
                                    }
                                } else {
                                    $u.warn("Missing 'class', 'tip' or 'stun'", currentMonster);
                                }
                            } else {
                                $u.warn("Missing tempText");
                            }
                        } else {
                            $u.warn("Missing nm_bottom");
                        }
                    }

                    if (monsterInfo) {
                        if (monsterInfo.siege) {
                            currentMonster['miss'] = $u.setContent($u.setContent($j("div[style*='monster_layout'],div[style*='nm_bottom'],div[style*='raid_back']", caap.appBodyDiv).text(), '').trim().innerTrim().regex(/Need (\d+) more/i), 0);
                            for (ind = 0, len = monsterInfo.siege_img.length; ind < len; ind += 1) {
                                searchStr += "img[src*='" + monsterInfo.siege_img[ind] + "']";
                                if (ind < len - 1) {
                                    searchStr += ",";
                                }
                            }

                            searchRes = $j(searchStr, caap.appBodyDiv);
                            if ($u.hasContent(searchRes)) {
                                totalCount = currentMonster['monster'] === "The Deathrune Siege" ? $u.setContent(searchRes.attr("src"), '').basename().replace(new RegExp(".*(\\d+).*", "gi"), "$1").parseInt() : searchRes.size() + 1;
                            }

                            currentMonster['phase'] = Math.min(totalCount, monsterInfo.siege);
                            if ($u.isNaN(currentMonster['phase']) || currentMonster['phase'] < 1) {
                                currentMonster['phase'] = 1;
                            }
                        }

                        currentMonster['t2k'] = monster.t2kCalc(currentMonster);
                    }
                } else {
                    $u.log(2, 'Monster is dead or fled');
                    currentMonster['color'] = 'grey';
                    if (currentMonster['status'] !== 'Complete' && currentMonster['status'] !== 'Collect Reward') {
                        currentMonster['status'] = "Dead or Fled";
                    }

                    currentMonster['hide'] = true;
                    currentMonster['joinable'] = {};
                    state.setItem('resetselectMonster', true);
                    monster.setItem(currentMonster);
                    return;
                }

                if ($u.hasContent(damageDiv)) {
                    achLevel = monster.parseCondition('ach', currentMonster['conditions']);
                    if (monsterInfo && achLevel === false) {
                        achLevel = monsterInfo.ach;
                    }

                    maxDamage = monster.parseCondition('max', currentMonster['conditions']);
                    maxToFortify = monster.parseCondition('f%', currentMonster['conditions']);
                    maxToFortify = maxToFortify !== false ? maxToFortify : config.getItem('MaxToFortify', 0);
                    targetFromfortify = state.getItem('targetFromfortify', new monster.energyTarget().data);
                    if (currentMonster['name'] === targetFromfortify['name']) {
                        if (targetFromfortify['type'] === 'Fortify' && currentMonster['fortify'] > maxToFortify) {
                            state.setItem('resetselectMonster', true);
                        }

                        if (targetFromfortify['type'] === 'Strengthen' && currentMonster['strength'] >= 100) {
                            state.setItem('resetselectMonster', true);
                        }

                        if (targetFromfortify['type'] === 'Stun' && !currentMonster['stunDo']) {
                            state.setItem('resetselectMonster', true);
                        }
                    }

                    // Start of Keep On Budget (KOB) code Part 1 -- required variables
                    $u.log(2, 'Start of Keep On Budget (KOB) Code');

                    //default is disabled for everything
                    KOBenable = false;

                    //default is zero bias hours for everything
                    KOBbiasHours = 0;

                    //KOB needs to follow achievment mode for this monster so that KOB can be skipped.
                    KOBach = false;

                    //KOB needs to follow max mode for this monster so that KOB can be skipped.
                    KOBmax = false;

                    //KOB needs to follow minimum fortification state for this monster so that KOB can be skipped.
                    KOBminFort = false;

                    //create a temp variable so we don't need to call parseCondition more than once for each if statement
                    KOBtmp = monster.parseCondition('kob', currentMonster['conditions']);
                    if (KOBtmp !== false && $u.isNaN(KOBtmp)) {
                        $u.log(2, 'KOB NaN branch');
                        KOBenable = true;
                        KOBbiasHours = 0;
                    } else if (KOBtmp === false) {
                        $u.log(2, 'KOB false branch');
                        KOBenable = false;
                        KOBbiasHours = 0;
                    } else {
                        $u.log(2, 'KOB passed value branch');
                        KOBenable = true;
                        KOBbiasHours = KOBtmp;
                    }

                    //test if user wants kob active globally
                    if (!KOBenable && gm.getItem('KOBAllMonters', false, hiddenVar)) {
                        KOBenable = true;
                    }

                    //disable kob if in level up mode or if we are within 5 stamina of max potential stamina
                    if (caap.inLevelUpMode() || caap.stats['stamina']['num'] >= caap.stats['stamina']['max'] - 5) {
                        KOBenable = false;
                    }

                    if (KOBenable) {
                        $u.log(2, 'Level Up Mode: ', caap.inLevelUpMode());
                        $u.log(2, 'Stamina Avail: ', caap.stats['stamina']['num']);
                        $u.log(2, 'Stamina Max: ', caap.stats['stamina']['max']);

                        //log results of previous two tests
                        $u.log(2, 'KOBenable: ', KOBenable);
                        $u.log(2, 'KOB Bias Hours: ', KOBbiasHours);
                    }

                    //Total Time alotted for monster
                    KOBtotalMonsterTime = monsterInfo.duration;
                    if (KOBenable) {
                        $u.log(2, 'Total Time for Monster: ', KOBtotalMonsterTime);

                        //Total Damage remaining
                        $u.log(2, 'HP left: ', currentMonster['life']);
                    }

                    //Time Left Remaining
                    KOBtimeLeft = time[0] + (time[1] * 0.0166);
                    if (KOBenable) {
                        $u.log(2, 'TimeLeft: ', KOBtimeLeft);
                    }

                    //calculate the bias offset for time remaining
                    KOBbiasedTF = KOBtimeLeft - KOBbiasHours;

                    //for 7 day monsters we want kob to not permit attacks (beyond achievement level) for the first 24 to 48 hours
                    // -- i.e. reach achievement and then wait for more players and siege assist clicks to catch up
                    if (KOBtotalMonsterTime >= 168) {
                        KOBtotalMonsterTime = KOBtotalMonsterTime - gm.getItem('KOBDelayStart', 48, hiddenVar);
                    }

                    //Percentage of time remaining for the currently selected monster
                    KOBPercentTimeRemaining = Math.round(KOBbiasedTF / KOBtotalMonsterTime * 1000) / 10;
                    if (KOBenable) {
                        $u.log(2, 'Percent Time Remaining: ', KOBPercentTimeRemaining);
                    }

                    // End of Keep On Budget (KOB) code Part 1 -- required variables

                    isTarget = (currentMonster['name'] === state.getItem('targetFromraid', '') ||
                                currentMonster['name'] === state.getItem('targetFrombattle_monster', '') ||
                                currentMonster['name'] === targetFromfortify['name']);

                    if (maxDamage && currentMonster['damage'] >= maxDamage) {
                        currentMonster['color'] = 'red';
                        currentMonster['over'] = 'max';
                        //used with KOB code
                        KOBmax = true;
                        //used with kob debugging
                        if (KOBenable) {
                            $u.log(2, 'KOB - max activated');
                        }

                        if (isTarget) {
                            state.setItem('resetselectMonster', true);
                        }
                    } else if (currentMonster['fortify'] !== -1 && currentMonster['fortify'] < config.getItem('MinFortToAttack', 1)) {
                        currentMonster['color'] = 'purple';
                        //used with KOB code
                        KOBminFort = true;
                        //used with kob debugging
                        if (KOBenable) {
                            $u.log(2, 'KOB - MinFort activated');
                        }

                        if (isTarget) {
                            state.setItem('resetselectMonster', true);
                        }
                    } else if (currentMonster['damage'] >= achLevel && (config.getItem('AchievementMode', false) || monster.parseCondition('ach', currentMonster['conditions']) !== false)) {
                        currentMonster['color'] = 'darkorange';
                        currentMonster['over'] = 'ach';
                        //used with KOB code
                        KOBach = true;
                        //used with kob debugging
                        if (KOBenable) {
                            $u.log(2, 'KOB - achievement reached');
                        }

                        if (isTarget && currentMonster['damage'] < achLevel) {
                            state.setItem('resetselectMonster', true);
                        }
                    }

                    //Start of KOB code Part 2 begins here
                    if (KOBenable && !KOBmax && !KOBminFort && KOBach && currentMonster['life'] < KOBPercentTimeRemaining) {
                        //kob color
                        currentMonster['color'] = 'magenta';
                        // this line is required or we attack anyway.
                        currentMonster['over'] = 'max';
                        //used with kob debugging
                        if (KOBenable) {
                            $u.log(2, 'KOB - budget reached');
                        }

                        if (isTarget) {
                            state.setItem('resetselectMonster', true);
                            $u.log(1, 'This monster no longer a target due to kob');
                        }
                    } else {
                        if (!KOBmax && !KOBminFort && !KOBach) {
                            //the way that the if statements got stacked, if it wasn't kob it was painted black anyway
                            //had to jump out the black paint if max, ach or fort needed to paint the entry.
                            currentMonster['color'] = $u.bestTextColor(state.getItem("StyleBackgroundLight", "#E0C961"));
                        }
                    }
                    //End of KOB code Part 2 stops here.
                } else {
                    currentMonster['color'] = $u.bestTextColor(state.getItem("StyleBackgroundLight", "#E0C961"));
                }

                monster.setItem(currentMonster);
                $u.log(3, "currentMonster", currentMonster);
                monster.select(true);
                caap.updateDashboard(true);
                if (schedule.check('battleTimer')) {
                    window.setTimeout(function () {
                        caap.setDivContent('monster_mess', '');
                    }, 2000);
                }
            } catch (err) {
                $u.error("ERROR in checkResults_viewFight: " + err);
            }
        },

        /*-------------------------------------------------------------------------------------\
        MonsterReview is a primary action subroutine to mange the monster and raid list
        on the dashboard
        \-------------------------------------------------------------------------------------*/
        monsterReview: function () {
            try {
                /*-------------------------------------------------------------------------------------\
                We do monster review once an hour.  Some routines may reset this timer to drive
                MonsterReview immediately.
                \-------------------------------------------------------------------------------------*/
                if (!schedule.check("monsterReview") || (config.getItem('WhenMonster', 'Never') === 'Never' && config.getItem('WhenBattle', 'Never') === 'Never')) {
                    return false;
                }

                /*-------------------------------------------------------------------------------------\
                We get the monsterReviewCounter.  This will be set to -3 if we are supposed to refresh
                the monsterOl completely. Otherwise it will be our index into how far we are into
                reviewing monsterOl.
                \-------------------------------------------------------------------------------------*/
                var fCounter    = config.getItem("festivalTower", false) ? -4 : -3,
                    counter     = state.getItem('monsterReviewCounter', fCounter),
                    link        = '',
                    tempTime    = 0,
                    isSiege     = false,
                    monsterInfo = {};

                if (counter === fCounter) {
                    state.setItem('monsterReviewCounter', counter += 1);
                    return true;
                }

                // festival tower
                if (config.getItem("festivalTower", false) && counter === -3) {
                    if (caap.stats['level'] > 6) {
                        if (caap.navigateTo('soldiers,festival_home,festival_tower', 'festival_monster_towerlist_button.jpg')) {
                            state.setItem('reviewDone', false);
                            return true;
                        }
                    } else {
                        $u.log(1, "Monsters: Unlock at level 7");
                        state.setItem('reviewDone', true);
                    }

                    /*
                    if (config.getItem('clearCompleteMonsters', false) && $u.hasContent(monster.completeButton['battle_monster']['button']) && $u.hasContent(monster.completeButton['battle_monster']['md5'])) {
                        caap.click(monster.completeButton['battle_monster']['button']);
                        monster.deleteItem(monster.completeButton['battle_monster']['md5']);
                        monster.completeButton['battle_monster'] = {'md5': undefined, 'name': undefined, 'button': undefined};
                        caap.updateDashboard(true);
                        $u.log(1, 'Cleared a completed monster');
                        return true;
                    }
                    */

                    if (state.getItem('reviewDone', true)) {
                        state.setItem('monsterReviewCounter', counter += 1);
                    } else {
                        return true;
                    }
                }

                if (counter === -2) {
                    if (caap.stats['level'] > 6) {
                        if (caap.navigateTo('keep,battle_monster', 'tab_monster_list_on.gif')) {
                            state.setItem('reviewDone', false);
                            return true;
                        }
                    } else {
                        $u.log(1, "Monsters: Unlock at level 7");
                        state.setItem('reviewDone', true);
                    }

                    if (config.getItem('clearCompleteMonsters', false) && $u.hasContent(monster.completeButton['battle_monster']['button']) && $u.hasContent(monster.completeButton['battle_monster']['md5'])) {
                        caap.click(monster.completeButton['battle_monster']['button']);
                        monster.deleteItem(monster.completeButton['battle_monster']['md5']);
                        monster.completeButton['battle_monster'] = {'md5': undefined, 'name': undefined, 'button': undefined};
                        caap.updateDashboard(true);
                        $u.log(1, 'Cleared a completed monster');
                        return true;
                    }

                    if (state.getItem('reviewDone', true)) {
                        state.setItem('monsterReviewCounter', counter += 1);
                    } else {
                        return true;
                    }
                }

                if (counter === -1) {
                    if (caap.stats['level'] > 7) {
                        // This is a temporary fix for the web3 url until CA fix their HTML
                        if (caap.domain.which === 2 && !$u.hasContent($j("img[src*='tab_raid_']", caap.appBodyDiv))) {
                            if (caap.navigateTo(caap.battlePage, 'battle_on.gif')) {
                                return true;
                            }

                            caap.clickAjaxLinkSend("raid.php");
                            return true;
                        }

                        if (caap.navigateTo(caap.battlePage + ',raid', 'tab_raid_on.gif')) {
                            state.setItem('reviewDone', false);
                            return true;
                        }
                    } else {
                        $u.log(1, "Raids: Unlock at level 8");
                        state.setItem('reviewDone', true);
                    }

                    if (config.getItem('clearCompleteRaids', false) && $u.hasContent(monster.completeButton['raid']['button']) && $u.hasContent(monster.completeButton['raid']['md5'])) {
                        caap.click(monster.completeButton['raid']['button']);
                        monster.deleteItem(monster.completeButton['raid']['md5']);
                        monster.completeButton['raid'] = {'md5': undefined, 'name': undefined, 'button': undefined};
                        caap.updateDashboard(true);
                        $u.log(1, 'Cleared a completed raid');
                        return true;
                    }

                    if (state.getItem('reviewDone', true)) {
                        state.setItem('monsterReviewCounter', counter += 1);
                    } else {
                        return true;
                    }
                }

                if (monster.records && monster.records.length === 0) {
                    return false;
                }

                /*-------------------------------------------------------------------------------------\
                Now we step through the monsterOl objects. We set monsterReviewCounter to the next
                index for the next reiteration since we will be doing a click and return in here.
                \-------------------------------------------------------------------------------------*/
                while (counter < monster.records.length) {
                    if (!monster.records[counter]) {
                        state.setItem('monsterReviewCounter', counter += 1);
                        continue;
                    }
                    /*-------------------------------------------------------------------------------------\
                    If we looked at this monster more recently than an hour ago, skip it
                    \-------------------------------------------------------------------------------------*/
                    if (monster.records[counter]['color'] === 'grey' && monster.records[counter]['life'] !== -1) {
                        monster.records[counter]['life'] = -1;
                        monster.records[counter]['fortify'] = -1;
                        monster.records[counter]['strength'] = -1;
                        monster.records[counter]['time'] = [];
                        monster.records[counter]['t2k'] = -1;
                        monster.records[counter]['phase'] = '';
                        monster.save();
                    }

                    tempTime = monster.records[counter]['review'] ? monster.records[counter]['review'] : -1;
                    $u.log(4, "Review", monster.records[counter], !schedule.since(tempTime, gm.getItem("MonsterLastReviewed", 15, hiddenVar) * 60));
                    if (monster.records[counter]['status'] === 'Complete' || !schedule.since(tempTime, gm.getItem("MonsterLastReviewed", 15, hiddenVar) * 60) || state.getItem('monsterRepeatCount', 0) > 2) {
                        state.setItem('monsterReviewCounter', counter += 1);
                        state.setItem('monsterRepeatCount', 0);
                        continue;
                    }
                    /*-------------------------------------------------------------------------------------\
                    We get our monster link
                    \-------------------------------------------------------------------------------------*/
                    caap.setDivContent('monster_mess', 'Reviewing/sieging ' + (counter + 1) + '/' + monster.records.length + ' ' + monster.records[counter]['name']);
                    link = monster.records[counter]['link'];
                    /*-------------------------------------------------------------------------------------\
                    If the link is good then we get the url and any conditions for monster
                    \-------------------------------------------------------------------------------------*/
                    if (/href/.test(link)) {
                        link = link.split("'")[1];
                        /*-------------------------------------------------------------------------------------\
                        If the autocollect token was specified then we set the link to do auto collect. If
                        the conditions indicate we should not do sieges then we fix the link.
                        \-------------------------------------------------------------------------------------*/
                        isSiege = monster.records[counter]['monster'] === 'The Deathrune Siege' ? true : false;
                        monsterInfo = monster.getInfo(monster.records[counter]);
                        $u.log(4, "monster.records[counter]", monster.records[counter]);
                        if (((monster.records[counter]['conditions'] && /:ac\b/.test(monster.records[counter]['conditions'])) ||
                                (isSiege && config.getItem('raidCollectReward', false)) ||
                                (!isSiege && config.getItem('monsterCollectReward', false))) && monster.records[counter]['status'] === 'Collect Reward') {

                            if (general.Select('CollectGeneral')) {
                                return true;
                            }

                            link += '&action=collectReward';
                            if (isSiege) {
                                if (monster.records[counter]['rix'] !== -1)  {
                                    link += '&rix=' + monster.records[counter]['rix'];
                                } else {
                                    link += '&rix=2';
                                }
                            }

                            link = link.replace('&action=doObjective', '');
                            state.setItem('CollectedRewards', true);
                        } else if ((monster.records[counter]['conditions'] && monster.records[counter]['conditions'].match(':!s')) ||
                                   (!config.getItem('raidDoSiege', true) && isSiege) ||
                                   (!config.getItem('monsterDoSiege', true) && !isSiege && monsterInfo && monsterInfo.siege) ||
                                   caap.stats['stamina']['num'] === 0) {
                            $u.log(2, "Do not siege");
                            link = link.replace('&action=doObjective', '');
                        }
                        /*-------------------------------------------------------------------------------------\
                        Now we use ajaxSendLink to display the monsters page.
                        \-------------------------------------------------------------------------------------*/
                        $u.log(1, 'Reviewing ' + (counter + 1) + '/' + monster.records.length + ' ' + monster.records[counter]['name']);
                        state.setItem('ReleaseControl', true);
                        link = link.replace(caap.domain.link + '/', '').replace('?', '?twt2&');

                        $u.log(3, "Link", link);
                        caap.clickAjaxLinkSend(link);
                        state.setItem('monsterRepeatCount', state.getItem('monsterRepeatCount', 0) + 1);
                        state.setItem('resetselectMonster', true);
                        return true;
                    }
                }
                /*-------------------------------------------------------------------------------------\
                All done.  Set timer and tell monster.select and dashboard they need to do thier thing.
                We set the monsterReviewCounter to do a full refresh next time through.
                \-------------------------------------------------------------------------------------*/
                schedule.setItem("monsterReview", gm.getItem('monsterReviewMins', 60, hiddenVar) * 60, 300);
                state.setItem('resetselectMonster', true);
                state.setItem('monsterReviewCounter', config.getItem("festivalTower", false) ? -4 : -3);
                $u.log(1, 'Done with monster/raid review.');
                caap.setDivContent('monster_mess', '');
                caap.updateDashboard(true);
                if (state.getItem('CollectedRewards', false)) {
                    state.setItem('CollectedRewards', false);
                    monster.flagReview();
                }

                return true;
            } catch (err) {
                $u.error("ERROR in monsterReview: " + err);
                return false;
            }
        },

        monsters: function () {
            try {
                if (config.getItem('WhenMonster', 'Never') === 'Never') {
                    caap.setDivContent('monster_mess', 'Monster off');
                    return false;
                }

                ///////////////// Reivew/Siege all monsters/raids \\\\\\\\\\\\\\\\\\\\\\

                if (config.getItem('WhenMonster', 'Never') === 'Stay Hidden' && caap.needToHide() && caap.checkStamina('Monster', 1)) {
                    $u.log(1, "Stay Hidden Mode: We're not safe. Go battle.");
                    caap.setDivContent('monster_mess', 'Not Safe For Monster. Battle!');
                    return false;
                }

                if (!schedule.check('NotargetFrombattle_monster')) {
                    return false;
                }

                ///////////////// Individual Monster Page \\\\\\\\\\\\\\\\\\\\\\

                // Establish a delay timer when we are 1 stamina below attack level.
                // Timer includes 5 min for stamina tick plus user defined random interval
                if (!caap.inLevelUpMode() && caap.stats['stamina']['num'] === (state.getItem('MonsterStaminaReq', 1) - 1) && schedule.check('battleTimer') && config.getItem('seedTime', 0) > 0) {
                    schedule.setItem('battleTimer', 300, config.getItem('seedTime', 0));
                    caap.setDivContent('monster_mess', 'Monster Delay Until ' + schedule.display('battleTimer'));
                    return false;
                }

                if (!schedule.check('battleTimer')) {
                    if (caap.stats['stamina']['num'] < general.GetStaminaMax(config.getItem('IdleGeneral', 'Use Current'))) {
                        caap.setDivContent('monster_mess', 'Monster Delay Until ' + schedule.display('battleTimer'));
                        return false;
                    }
                }

                var fightMode        = '',
                    targetMonster    = state.getItem('targetFromfortify', new monster.energyTarget().data),
                    monsterName      = targetMonster['name'],
                    nodeNum          = 0,
                    energyRequire    = 10,
                    currentMonster   = monster.getItem(targetMonster['md5']),
                    monsterInfo      = monster.getInfo(currentMonster),
                    attackButton     = null,
                    singleButtonList = [],
                    buttonList       = [],
                    tacticsValue     = 0,
                    useTactics       = false,
                    attackMess       = '',
                    pageUserCheck    = 0,
                    it               = 0,
                    len              = 0,
                    buttonHref       = '',
                    theGeneral       = config.getItem('FortifyGeneral', 'Use Current');

                monsterInfo = $u.hasContent(currentMonster['type']) ? (currentMonster['type'] === "Raid II" ? monsterInfo.stage2 : monsterInfo.stage1) : monsterInfo;
                if (monsterInfo) {
                    if (!caap.inLevelUpMode() && config.getItem('PowerFortifyMax', false) && monsterInfo.staLvl) {
                        for (nodeNum = monsterInfo.staLvl.length - 1; nodeNum >= 0; nodeNum -= 1) {
                            if (caap.stats['stamina']['max'] >= monsterInfo.staLvl[nodeNum]) {
                                break;
                            }
                        }
                    }

                    energyRequire = $u.isDefined(nodeNum) && nodeNum >= 0 && config.getItem('PowerAttackMax', false) && monsterInfo.nrgMax ? monsterInfo.nrgMax[nodeNum] : monsterInfo.nrgMax ? monsterInfo.nrgMax[0] : energyRequire;
                }

                $u.log(4, "Energy Required/Node", energyRequire, nodeNum);
                theGeneral = theGeneral === "Under Level" ? (config.getItem('ReverseLevelUpGenerals') ? general.GetLevelUpNames().reverse().pop() : general.GetLevelUpNames().pop()) : theGeneral;
                switch (theGeneral) {
                case 'Orc King':
                    energyRequire = energyRequire * (general.GetLevel('Orc King') + 1);
                    $u.log(3, 'Monsters Fortify:Orc King', energyRequire);
                    break;
                case 'Barbarus':
                    energyRequire = energyRequire * (general.GetLevel('Barbarus') === 4 ? 3 : 2);
                    $u.log(3, 'Monsters Fortify:Barbarus', energyRequire);
                    break;
                case 'Maalvus':
                    energyRequire = energyRequire * (general.GetLevel('Maalvus') >= 3 ? 3 : 2);
                    $u.log(2, 'Monsters Fortify:Maalvus', energyRequire);
                    break;
                default:
                }

                // Check to see if we should fortify or attack monster
                if (monsterName && caap.checkEnergy(energyRequire, gm.getItem('WhenFortify', 'Energy Available', hiddenVar), 'fortify_mess')) {
                    fightMode = 'Fortify';
                } else {
                    targetMonster = state.getItem('targetFrombattle_monster', '');
                    currentMonster = monster.getItem(targetMonster);
                    monsterName = currentMonster['name'];
                    monsterInfo = monster.getInfo(currentMonster);
                    if (monsterName && caap.checkStamina('Monster', state.getItem('MonsterStaminaReq', 1)) && currentMonster['page'].replace('festival_battle_monster', 'battle_monster') === 'battle_monster') {
                        fightMode = 'Monster';
                    } else {
                        schedule.setItem('NotargetFrombattle_monster', 60);
                        return false;
                    }
                }

                // Set right general
                if (general.Select(fightMode + 'General')) {
                    return true;
                }

                // Check if on engage monster page
                if ($u.hasContent($j("div[style*='dragon_title_owner'],div[style*='nm_top'],div[style*='monster_header_'],div[style*='festival_monsters_top_']", caap.appBodyDiv))) {
                    if (monster.confirmRightPage(monsterName)) {
                        return true;
                    }

                    singleButtonList = [
                        'button_nm_p_attack.gif',
                        'attack_monster_button.jpg',
                        'event_attack1.gif',
                        'seamonster_attack.gif',
                        'event_attack2.gif',
                        'attack_monster_button2.jpg'
                    ];

                    // Find the attack or fortify button
                    if (fightMode === 'Fortify') {
                        buttonList = [
                            'seamonster_fortify.gif',
                            'button_dispel.gif',
                            'attack_monster_button3.jpg'
                        ];

                        if (monsterInfo && monsterInfo.fortify_img) {
                            buttonList.unshift(monsterInfo.fortify_img[0]);
                        }

                        if (currentMonster && currentMonster['stunDo'] && currentMonster['stunType'] !== '') {
                            buttonList.unshift("button_nm_s_" + currentMonster['stunType']);
                        } else {
                            buttonList.unshift("button_nm_s_");
                        }
                    } else if (state.getItem('MonsterStaminaReq', 1) === 1) {
                        // not power attack only normal attacks
                        buttonList = singleButtonList;
                    } else {
                        if (currentMonster['conditions'] && currentMonster['conditions'].match(/:tac/i) && caap.stats['level'] >= 50) {
                            useTactics = true;
                            tacticsValue = monster.parseCondition("tac%", currentMonster['conditions']);
                        } else if (config.getItem('UseTactics', false) && caap.stats['level'] >= 50) {
                            useTactics = true;
                            tacticsValue = config.getItem('TacticsThreshold', false);
                        }

                        if (tacticsValue !== false && currentMonster['fortify'] && currentMonster['fortify'] < tacticsValue) {
                            $u.log(2, "Party health is below threshold value", currentMonster['fortify'], tacticsValue);
                            useTactics = false;
                        }

                        if (useTactics && caap.hasImage('nm_button_tactics.gif')) {
                            $u.log(2, "Attacking monster using tactics buttons");
                            buttonList = ['nm_button_tactics.gif'].concat(singleButtonList);
                        } else {
                            $u.log(2, "Attacking monster using regular buttons");
                            useTactics = false;
                            // power attack or if not seamonster power attack or if not regular attack -
                            // need case for seamonster regular attack?
                            buttonList = [
                                'button_nm_p_power',
                                'button_nm_p_',
                                'power_button_',
                                'attack_monster_button2.jpg',
                                'event_attack2.gif',
                                'seamonster_power.gif',
                                'event_attack1.gif',
                                'attack_monster_button.jpg'
                            ].concat(singleButtonList);

                            if (monsterInfo && monsterInfo.attack_img) {
                                if (!caap.inLevelUpMode() && config.getItem('PowerAttack', false) && config.getItem('PowerAttackMax', false)) {
                                    buttonList.unshift(monsterInfo.attack_img[1]);
                                } else {
                                    buttonList.unshift(monsterInfo.attack_img[0]);
                                }
                            }
                        }
                    }

                    $u.log(4, "monster/button list", currentMonster, buttonList);
                    nodeNum = 0;
                    if (!caap.inLevelUpMode()) {
                        if (((fightMode === 'Fortify' && config.getItem('PowerFortifyMax', false)) || (fightMode !== 'Fortify' && config.getItem('PowerAttack', false) && config.getItem('PowerAttackMax', false))) && monsterInfo.staLvl) {
                            for (nodeNum = monsterInfo.staLvl.length - 1; nodeNum >= 0; nodeNum -= 1) {
                                if (caap.stats['stamina']['max'] >= monsterInfo.staLvl[nodeNum]) {
                                    break;
                                }
                            }
                        }
                    }

                    for (it = 0, len = buttonList.length; it < len; it += 1) {
                        attackButton = caap.checkForImage(buttonList[it], null, null, nodeNum);
                        if ($u.hasContent(attackButton)) {
                            break;
                        }
                    }

                    if (attackButton) {
                        if (fightMode === 'Fortify') {
                            attackMess = 'Fortifying ' + monsterName;
                        } else if (useTactics) {
                            attackMess = 'Tactic Attacking ' + monsterName;
                        } else {
                            attackMess = (state.getItem('MonsterStaminaReq', 1) >= 5 ? 'Power' : 'Single') + ' Attacking ' + monsterName;
                        }

                        $u.log(1, attackMess);
                        caap.setDivContent('monster_mess', attackMess);
                        state.setItem('ReleaseControl', true);
                        caap.click(attackButton);
                        return true;
                    } else {
                        $u.warn('No button to attack/fortify with.');
                        schedule.setItem('NotargetFrombattle_monster', 60);
                        return false;
                    }
                }

                ///////////////// Check For Monster Page \\\\\\\\\\\\\\\\\\\\\\
                if (currentMonster['page'] === 'battle_monster') {
                    if (caap.navigateTo('keep,battle_monster', 'tab_monster_list_on.gif')) {
                        return true;
                    }
                } else if (currentMonster['page'] === 'festival_battle_monster') {
                    if (caap.navigateTo('soldiers,festival_home,festival_tower', 'festival_monster_towerlist_button.jpg')) {
                        return true;
                    }
                } else {
                    $u.warn('What kind of monster?', currentMonster);
                    return false;
                }

                buttonHref = $u.setContent($j("img[src*='dragon_list_btn_']", caap.appBodyDiv).eq(0).parent().attr("href"), '');
                pageUserCheck = state.getItem('pageUserCheck', 0);
                if (pageUserCheck && (!buttonHref || !new RegExp('user=' + caap.stats['FBID']).test(buttonHref) || !/alchemy\.php/.test(buttonHref))) {
                    $u.log(2, "On another player's keep.", pageUserCheck);
                    if (currentMonster['page'] === 'battle_monster') {
                        return caap.navigateTo('keep,battle_monster', 'tab_monster_list_on.gif');
                    } else if (currentMonster['page'] === 'festival_battle_monster') {
                        return caap.navigateTo('soldiers,festival_home,festival_tower', 'festival_monster_towerlist_button.jpg');
                    } else {
                        $u.warn('What kind of monster?', currentMonster);
                        return false;
                    }
                }

                if (config.getItem('clearCompleteMonsters', false) && $u.hasContent(monster.completeButton['battle_monster']['button']) && $u.hasContent(monster.completeButton['battle_monster']['md5'])) {
                    caap.click(monster.completeButton['battle_monster']['button']);
                    monster.deleteItem(monster.completeButton['battle_monster']['md5']);
                    monster.completeButton['battle_monster'] = {'md5': undefined, 'name': undefined, 'button': undefined};
                    caap.updateDashboard(true);
                    $u.log(1, 'Cleared a completed monster');
                    return true;
                }

                if ($u.hasContent(monster.engageButtons[currentMonster['md5']])) {
                    caap.setDivContent('monster_mess', 'Opening ' + monsterName);
                    caap.click(monster.engageButtons[currentMonster['md5']]);
                    return true;
                } else {
                    schedule.setItem('NotargetFrombattle_monster', 60);
                    $u.warn('No "Engage" button for ', monsterName);
                    return false;
                }
            } catch (err) {
                $u.error("ERROR in monsters: " + err);
                return false;
            }
        },

        demi: {
            'ambrosia' : {
                'power' : {
                    'total' : 0,
                    'max'   : 0,
                    'next'  : 0
                },
                'daily' : {
                    'num' : 0,
                    'max' : 0,
                    'dif' : 0
                }
            },
            'malekus' : {
                'power' : {
                    'total' : 0,
                    'max'   : 0,
                    'next'  : 0
                },
                'daily' : {
                    'num' : 0,
                    'max' : 0,
                    'dif' : 0
                }
            },
            'corvintheus' : {
                'power' : {
                    'total' : 0,
                    'max'   : 0,
                    'next'  : 0
                },
                'daily' : {
                    'num' : 0,
                    'max' : 0,
                    'dif' : 0
                }
            },
            'aurora' : {
                'power' : {
                    'total' : 0,
                    'max'   : 0,
                    'next'  : 0
                },
                'daily' : {
                    'num' : 0,
                    'max' : 0,
                    'dif' : 0
                }
            },
            'azeron' : {
                'power' : {
                    'total' : 0,
                    'max'   : 0,
                    'next'  : 0
                },
                'daily' : {
                    'num' : 0,
                    'max' : 0,
                    'dif' : 0
                }
            }
        },
        /*jslint sub: false */

        loadDemi: function () {
            var demis = gm.getItem('demipoint.records', 'default');
            if (demis === 'default' || !$j.isPlainObject(demis)) {
                demis = gm.setItem('demipoint.records', caap.demi);
            }

            $j.extend(true, caap.demi, demis);
            $u.log(4, 'Demi', caap.demi);
            state.setItem("UserDashUpdate", true);
        },

        SaveDemi: function () {
            gm.setItem('demipoint.records', caap.demi);
            $u.log(4, 'Demi', caap.demi);
            state.setItem("UserDashUpdate", true);
        },

        demiTable: {
            0 : 'ambrosia',
            1 : 'malekus',
            2 : 'corvintheus',
            3 : 'aurora',
            4 : 'azeron'
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checkResults_battle: function () {
            try {
                var symDiv  = $j(),
                    points  = [],
                    success = true;

                battle.checkResults();
                symDiv = caap.appBodyDiv.find("img[src*='symbol_tiny_']").not("img[src*='rewards.jpg']");
                if ($u.hasContent(symDiv) && symDiv.length === 5) {
                    symDiv.each(function (index) {
                        var txt = '';
                        txt = $j(this).parent().parent().next().text();
                        txt = txt ? txt.replace(/\s/g, '') : '';
                        if (txt) {
                            points.push(txt);
                        } else {
                            success = false;
                            $u.warn('Demi temp text problem', txt);
                        }
                    });

                    if (success) {
                        caap.demi['ambrosia']['daily'] = caap.getStatusNumbers(points[0]);
                        caap.demi['malekus']['daily'] = caap.getStatusNumbers(points[1]);
                        caap.demi['corvintheus']['daily'] = caap.getStatusNumbers(points[2]);
                        caap.demi['aurora']['daily'] = caap.getStatusNumbers(points[3]);
                        caap.demi['azeron']['daily'] = caap.getStatusNumbers(points[4]);
                        schedule.setItem("battle", gm.getItem('CheckDemi', 6, hiddenVar) * 3600, 300);
                        caap.SaveDemi();
                    }
                } else {
                    $u.warn('Demi symDiv problem');
                }

                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_battle: " + err);
                return false;
            }
        },

        demiPoints: function () {
            try {
                if (caap.stats['level'] < 9) {
                    return false;
                }

                if (!config.getItem('DemiPointsFirst', false) || config.getItem('WhenMonster', 'Never') === 'Never') {
                    return false;
                }

                if (schedule.check("battle")) {
                    if (caap.navigateTo(caap.battlePage, 'battle_on.gif')) {
                        return true;
                    }
                }

                var demiPointsDone = false;
                demiPointsDone = battle.selectedDemisDone();
                state.setItem("DemiPointsDone", demiPointsDone);
                if (!demiPointsDone) {
                    return caap.battle('DemiPoints');
                } else {
                    return false;
                }
            } catch (err) {
                $u.error("ERROR in demiPoints: " + err);
                return false;
            }
        },

        inLevelUpMode: function () {
            try {
                if (!config.getItem('EnableLevelUpMode', true)) {
                    //if levelup mode is false then new level up mode is also false (kob)
                    state.setItem("newLevelUpMode", false);
                    return false;
                }

                if (!caap.stats['indicators']['enl']) {
                    //if levelup mode is false then new level up mode is also false (kob)
                    state.setItem("newLevelUpMode", false);
                    return false;
                }

                // minutesBeforeLevelToUseUpStaEnergy : 5, = 30000
                if (((caap.stats['indicators']['enl'] - new Date().getTime()) < 30000) || (caap.stats['exp']['dif'] <= config.getItem('LevelUpGeneralExp', 20))) {
                    //detect if we are entering level up mode for the very first time (kob)
                    if (!state.getItem("newLevelUpMode", false)) {
                        //set the current level up mode flag so that we don't call refresh monster routine more than once (kob)
                        state.setItem("newLevelUpMode", true);
                        caap.refreshMonstersListener();
                    }

                    return true;
                }

                //if levelup mode is false then new level up mode is also false (kob)
                state.setItem("newLevelUpMode", false);
                return false;
            } catch (err) {
                $u.error("ERROR in inLevelUpMode: " + err);
                return false;
            }
        },

        checkStamina: function (battleOrMonster, attackMinStamina) {
            try {
                $u.log(4, "checkStamina", battleOrMonster, attackMinStamina);
                if (!attackMinStamina) {
                    attackMinStamina = 1;
                }

                var when           = config.getItem('When' + battleOrMonster, 'Never'),
                    maxIdleStamina = 0,
                    theGeneral     = '',
                    staminaMF      = '',
                    messDiv        = battleOrMonster.toLowerCase() + "_mess";

                if (when === 'Never') {
                    return false;
                }

                if (!caap.stats['stamina'] || !caap.stats['health']) {
                    caap.setDivContent(messDiv, 'Health or stamina not known yet.');
                    return false;
                }

                if (caap.stats['health']['num'] < 10) {
                    caap.setDivContent(messDiv, "Need health to fight: " + caap.stats['health']['num'] + "/10");
                    return false;
                }

                if (battleOrMonster === "Battle" && config.getItem("waitSafeHealth", false) && caap.stats['health']['num'] < 13) {
                    caap.setDivContent(messDiv, "Unsafe. Need spare health to fight: " + caap.stats['health']['num'] + "/13");
                    return false;
                }

                if (when === 'At X Stamina') {
                    if (caap.inLevelUpMode() && caap.stats['stamina']['num'] >= attackMinStamina) {
                        caap.setDivContent(messDiv, 'Burning stamina to level up');
                        return true;
                    }

                    staminaMF = battleOrMonster + 'Stamina';
                    if (state.getItem('BurnMode_' + staminaMF, false) || caap.stats['stamina']['num'] >= config.getItem('X' + staminaMF, 1)) {
                        if (caap.stats['stamina']['num'] < attackMinStamina || caap.stats['stamina']['num'] <= config.getItem('XMin' + staminaMF, 0)) {
                            state.setItem('BurnMode_' + staminaMF, false);
                            return false;
                        }

                        state.setItem('BurnMode_' + staminaMF, true);
                        return true;
                    } else {
                        state.setItem('BurnMode_' + staminaMF, false);
                    }

                    caap.setDivContent(messDiv, 'Waiting for stamina: ' + caap.stats['stamina']['num'] + "/" + config.getItem('X' + staminaMF, 1));
                    return false;
                }

                if (when === 'At Max Stamina') {
                    maxIdleStamina = caap.stats['stamina']['max'];
                    theGeneral = config.getItem('IdleGeneral', 'Use Current');
                    if (theGeneral !== 'Use Current') {
                        maxIdleStamina = general.GetStaminaMax(theGeneral);
                    }

                    if (theGeneral !== 'Use Current' && !maxIdleStamina) {
                        $u.log(2, "Changing to idle general to get Max Stamina");
                        if (general.Select('IdleGeneral')) {
                            return true;
                        }
                    }

                    if (caap.stats['stamina']['num'] >= maxIdleStamina) {
                        caap.setDivContent(messDiv, 'Using max stamina');
                        return true;
                    }

                    if (caap.inLevelUpMode() && caap.stats['stamina']['num'] >= attackMinStamina) {
                        caap.setDivContent(messDiv, 'Burning all stamina to level up');
                        return true;
                    }

                    caap.setDivContent(messDiv, 'Waiting for max stamina: ' + caap.stats['stamina']['num'] + "/" + maxIdleStamina);
                    return false;
                }

                if (caap.stats['stamina']['num'] >= attackMinStamina) {
                    return true;
                }

                caap.setDivContent(messDiv, "Waiting for more stamina: " + caap.stats['stamina']['num'] + "/" + attackMinStamina);
                return false;
            } catch (err) {
                $u.error("ERROR in checkStamina: " + err);
                return false;
            }
        },

        /*-------------------------------------------------------------------------------------\
        needToHide will return true if the current stamina and health indicate we need to bring
        our health down through battles (hiding).  It also returns true if there is no other outlet
        for our stamina (currently this just means Monsters, but will eventually incorporate
        other stamina uses).
        \-------------------------------------------------------------------------------------*/
        needToHide: function () {
            try {
                if (config.getItem('WhenMonster', 'Never') === 'Never') {
                    $u.log(1, 'Stay Hidden Mode: Monster battle not enabled');
                    return true;
                }

                if (!state.getItem('targetFrombattle_monster', '')) {
                    $u.log(1, 'Stay Hidden Mode: No monster to battle');
                    return true;
                }
            /*-------------------------------------------------------------------------------------\
            The riskConstant helps us determine how much we stay in hiding and how much we are willing
            to risk coming out of hiding.  The lower the riskConstant, the more we spend stamina to
            stay in hiding. The higher the risk constant, the more we attempt to use our stamina for
            non-hiding activities.  The below matrix shows the default riskConstant of 1.7

                        S   T   A   M   I   N   A
                        1   2   3   4   5   6   7   8   9        -  Indicates we use stamina to hide
                H   10  -   -   +   +   +   +   +   +   +        +  Indicates we use stamina as requested
                E   11  -   -   +   +   +   +   +   +   +
                A   12  -   -   +   +   +   +   +   +   +
                L   13  -   -   +   +   +   +   +   +   +
                T   14  -   -   -   +   +   +   +   +   +
                H   15  -   -   -   +   +   +   +   +   +
                    16  -   -   -   -   +   +   +   +   +
                    17  -   -   -   -   -   +   +   +   +
                    18  -   -   -   -   -   +   +   +   +

            Setting our riskConstant down to 1 will result in us spending out stamina to hide much
            more often:

                        S   T   A   M   I   N   A
                        1   2   3   4   5   6   7   8   9        -  Indicates we use stamina to hide
                H   10  -   -   +   +   +   +   +   +   +        +  Indicates we use stamina as requested
                E   11  -   -   +   +   +   +   +   +   +
                A   12  -   -   -   +   +   +   +   +   +
                L   13  -   -   -   -   +   +   +   +   +
                T   14  -   -   -   -   -   +   +   +   +
                H   15  -   -   -   -   -   -   +   +   +
                    16  -   -   -   -   -   -   -   +   +
                    17  -   -   -   -   -   -   -   -   +
                    18  -   -   -   -   -   -   -   -   -

            \-------------------------------------------------------------------------------------*/
                var riskConstant = gm.getItem('HidingRiskConstant', 1.7, hiddenVar);
            /*-------------------------------------------------------------------------------------\
            The formula for determining if we should hide goes something like this:

                If  (health - (estimated dmg from next attacks) puts us below 10)  AND
                    (current stamina will be at least 5 using staminatime/healthtime ratio)
                Then stamina can be used/saved for normal process
                Else stamina is used for us to hide

            \-------------------------------------------------------------------------------------*/
                //if ((caap.stats['health']['num'] - ((caap.stats['stamina']['num'] - 1) * riskConstant) < 10) && (caap.stats['stamina']['num'] * (5 / 3) >= 5)) {
                if ((caap.stats['health']['num'] - ((caap.stats['stamina']['num'] - 1) * riskConstant) < 10) && ((caap.stats['stamina']['num'] + gm.getItem('HideStaminaRisk', 1, hiddenVar)) >= state.getItem('MonsterStaminaReq', 1))) {
                    return false;
                } else {
                    return true;
                }
            } catch (err) {
                $u.error("ERROR in needToHide: " + err);
                return undefined;
            }
        },
        /*jslint sub: false */

        /////////////////////////////////////////////////////////////////////
        //                          POTIONS
        /////////////////////////////////////////////////////////////////////

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        autoPotions: function () {
            try {
                if (!config.getItem('AutoPotions', true) || !schedule.check('AutoPotionTimerDelay')) {
                    return false;
                }

                if (caap.stats['exp']['dif'] <= config.getItem("potionsExperience", 20)) {
                    $u.log(2, "AutoPotions, ENL condition. Delaying 10 minutes");
                    schedule.setItem('AutoPotionTimerDelay', 600);
                    return false;
                }

                function consumePotion(potion) {
                    try {
                        if (!$j(".statsTTitle").length) {
                            $u.log(2, "Going to keep for potions");
                            if (caap.navigateTo('keep')) {
                                return true;
                            }
                        }

                        var formId    =  caap.domain.id[caap.domain.which] + "consume_1",
                            potionDiv = $j(),
                            button    = null;

                        if (potion === 'stamina') {
                            formId = caap.domain.id[caap.domain.which] + "consume_2";
                        }

                        $u.log(1, "Consuming potion", potion);
                        potionDiv = $j("form[id='" + formId + "'] input[src*='potion_consume.gif']");
                        if (potionDiv && potionDiv.length) {
                            button = potionDiv;
                            if (button) {
                                caap.click(button);
                            } else {
                                $u.warn("Could not find consume button for", potion);
                                return false;
                            }
                        } else {
                            $u.warn("Could not find consume form for", potion);
                            return false;
                        }

                        return true;
                    } catch (err) {
                        $u.error("ERROR in consumePotion: " + err, potion);
                        return false;
                    }
                }

                if (caap.stats['energy']['num'] < caap.stats['energy']['max'] - 10 &&
                    caap.stats['potions']['energy'] >= config.getItem("energyPotionsSpendOver", 39) &&
                    caap.stats['potions']['energy'] > config.getItem("energyPotionsKeepUnder", 35)) {
                    return consumePotion('energy');
                }

                if (caap.stats['stamina']['num'] < caap.stats['stamina']['max'] - 10 &&
                    caap.stats['potions']['stamina'] >= config.getItem("staminaPotionsSpendOver", 39) &&
                    caap.stats['potions']['stamina'] > config.getItem("staminaPotionsKeepUnder", 35)) {
                    return consumePotion('stamina');
                }

                return false;
            } catch (err) {
                $u.error("ERROR in autoPotions: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        /////////////////////////////////////////////////////////////////////
        //                          ALCHEMY
        /////////////////////////////////////////////////////////////////////

        /*-------------------------------------------------------------------------------------\
        AutoAlchemy perform aclchemy combines for all recipes that do not have missing
        ingredients.  By default, it also will not combine Battle Hearts.
        First we make sure the option is set and that we haven't been here for a while.
        \-------------------------------------------------------------------------------------*/
        autoAlchemy: function () {
            try {
                if (!config.getItem('AutoAlchemy', false)) {
                    return false;
                }

                if (!schedule.check('AlchemyTimer')) {
                    return false;
                }
        /*-------------------------------------------------------------------------------------\
        Now we navigate to the Alchemy Recipe page.
        \-------------------------------------------------------------------------------------*/
                if (!caap.navigateTo('keep,alchemy', 'tab_alchemy_on.gif')) {
                    var button    = {},
                        recipeDiv = $j(),
                        ss        = $j(),
                        clicked   = false;

                    recipeDiv = $j("#" + caap.domain.id[caap.domain.which] + "recipe_list");
                    if (recipeDiv && recipeDiv.length) {
                        if (recipeDiv.attr("class") !== 'show_items') {
                            button = recipeDiv.find("div[id*='alchemy_item_tab']");
                            if (button && button.length) {
                                caap.click(button);
                                return true;
                            } else {
                                $u.warn('Cant find item tab', recipeDiv);
                                return false;
                            }
                        }
                    } else {
                        $u.warn('Cant find recipe list');
                        return false;
                    }
        /*-------------------------------------------------------------------------------------\
        We close the results of our combines so they don't hog up our screen
        \-------------------------------------------------------------------------------------*/
                    button = caap.checkForImage('help_close_x.gif');
                    if ($u.hasContent(button)) {
                        caap.click(button);
                        return true;
                    }
        /*-------------------------------------------------------------------------------------\
        Now we get all of the recipes and step through them one by one
        \-------------------------------------------------------------------------------------*/
                    ss = $j("div[class='alchemyRecipeBack']");
                    if (!ss || !ss.length) {
                        $u.log(2, 'No recipes found');
                    }

                    ss.each(function () {
                        recipeDiv = $j(this);
        /*-------------------------------------------------------------------------------------\
        If we are missing an ingredient then skip it
        \-------------------------------------------------------------------------------------*/
                        if (recipeDiv.find("div[class*='missing']").length) {
                            $u.log(2, 'Skipping Recipe');
                            return true;
                        }
        /*-------------------------------------------------------------------------------------\
        If we are skipping battle hearts then skip it
        \-------------------------------------------------------------------------------------*/
                        if (caap.hasImage('raid_hearts', recipeDiv) && !config.getItem('AutoAlchemyHearts', false)) {
                            $u.log(2, 'Skipping Hearts');
                            return true;
                        }
        /*-------------------------------------------------------------------------------------\
        Find our button and click it
        \-------------------------------------------------------------------------------------*/
                        button = recipeDiv.find("input[type='image']");
                        if (button && button.length) {
                            clicked = true;
                            caap.click(button);
                            $u.log(2, 'Clicked A Recipe', recipeDiv.find("img").attr("title"));
                            return false;
                        } else {
                            $u.warn('Cant Find Item Image Button');
                        }

                        return true;
                    });

                    if (clicked) {
                        return true;
                    }
        /*-------------------------------------------------------------------------------------\
        All done. Set the timer to check back in 3 hours.
        \-------------------------------------------------------------------------------------*/
                    schedule.setItem('AlchemyTimer', 10800, 300);
                    return false;
                }

                return true;
            } catch (err) {
                $u.error("ERROR in autoAlchemy: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          BANKING
        // Keep it safe!
        /////////////////////////////////////////////////////////////////////

        immediateBanking: function () {
            if (!config.getItem("BankImmed", false)) {
                return false;
            }

            return caap.bank();
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        bank: function () {
            try {
                if (config.getItem("NoBankAfterLvl", true) && state.getItem('KeepLevelUpGeneral', false)) {
                    return false;
                }

                var maxInCash     = -1,
                    minInCash     = 0,
                    depositButton = null,
                    numberInput   = null,
                    deposit       = 0;

                maxInCash = config.getItem('MaxInCash', -1);
                minInCash = config.getItem('MinInCash', 0);
                if (!maxInCash || maxInCash < 0 || caap.stats['gold']['cash'] <= minInCash || caap.stats['gold']['cash'] < maxInCash || caap.stats['gold']['cash'] < 10) {
                    return false;
                }

                if (general.Select('BankingGeneral')) {
                    return true;
                }

                depositButton = $j("input[src*='btn_stash.gif']");
                if (!depositButton || !depositButton.length) {
                    // Cannot find the link
                    return caap.navigateTo('keep');
                }

                numberInput = $j("input[name='stash_gold']");
                if (!numberInput || !numberInput.length) {
                    $u.warn('Cannot find box to put in number for bank deposit.');
                    return false;
                }

                deposit = numberInput.attr("value").parseInt() - minInCash;
                numberInput.attr("value", deposit);
                $u.log(1, 'Depositing into bank:', deposit);
                caap.click(depositButton);
                return true;
            } catch (err) {
                $u.error("ERROR in Bank: " + err);
                return false;
            }
        },

        retrieveFromBank: function (num) {
            try {
                if (num <= 0) {
                    return false;
                }

                var retrieveButton = null,
                    numberInput    = null,
                    minInStore     = 0;

                retrieveButton = $j("input[src*='btn_retrieve.gif']");
                if (!retrieveButton || !retrieveButton.length) {
                    // Cannot find the link
                    return caap.navigateTo('keep');
                }

                minInStore = config.getItem('minInStore', 0);
                if (!(minInStore || minInStore <= caap.stats['gold']['bank'] - num)) {
                    return false;
                }

                numberInput = $j("input[name='get_gold']");
                if (!numberInput || !numberInput.length) {
                    $u.warn('Cannot find box to put in number for bank retrieve.');
                    return false;
                }

                numberInput.attr("value", num);
                $u.log(1, 'Retrieving from bank:', num);
                state.setItem('storeRetrieve', '');
                caap.click(retrieveButton);
                return true;
            } catch (err) {
                $u.error("ERROR in retrieveFromBank: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          HEAL
        /////////////////////////////////////////////////////////////////////

        heal: function () {
            try {
                var minToHeal     = 0,
                    minStamToHeal = 0;

                caap.setDivContent('heal_mess', '');
                minToHeal = config.getItem('MinToHeal', 0);
                if (minToHeal === "" || minToHeal < 0 || !$u.isNumber(minToHeal)) {
                    return false;
                }

                minStamToHeal = config.getItem('MinStamToHeal', 0);
                if (minStamToHeal === "" || minStamToHeal < 0 || !$u.isNumber(minStamToHeal)) {
                    minStamToHeal = 0;
                }

                if (!caap.stats['health'] || $j.isEmptyObject(caap.stats['health']) || $j.isEmptyObject(caap.stats['healthT'])) {
                    return false;
                }

                if (!caap.stats['stamina'] || $j.isEmptyObject(caap.stats['stamina']) || $j.isEmptyObject(caap.stats['staminaT'])) {
                    return false;
                }

                if ((config.getItem('WhenBattle', 'Never') !== 'Never') || (config.getItem('WhenMonster', 'Never') !== 'Never')) {
                    if ((caap.inLevelUpMode() || caap.stats['stamina']['num'] >= caap.stats['staminaT']['max']) && caap.stats['health']['num'] < (config.getItem('WhenBattle', 'Never') !== 'Never' && config.getItem('waitSafeHealth', false) ? 13 : 10)) {
                        $u.log(1, 'Heal');
                        return caap.navigateTo('keep,heal_button.gif');
                    }
                }

                if (caap.stats['health']['num'] >= caap.stats['healthT']['max'] || caap.stats['health']['num'] >= minToHeal) {
                    return false;
                }

                if (caap.stats['stamina']['num'] < minStamToHeal) {
                    caap.setDivContent('heal_mess', 'Waiting for stamina to heal: ' + caap.stats['stamina']['num'] + '/' + minStamToHeal);
                    return false;
                }

                $u.log(1, 'Heal');
                return caap.navigateTo('keep,heal_button.gif');
            } catch (err) {
                $u.error("ERROR in heal: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          ELITE GUARD
        /////////////////////////////////////////////////////////////////////

        checkResults_party: function () {
            try {
                if ($u.hasContent($j("input[src*='elite_guard_request.gif']", caap.appBodyDiv))) {
                    army.eliteCheckImg();
                } else {
                    army.eliteResult();
                }

                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_army_member: " + err);
                return false;
            }
        },

        autoElite: function () {
            try {
                if (!config.getItem("EnableArmy", true) || !config.getItem('AutoElite', true) || !schedule.check('AutoEliteGetList')) {
                    return false;
                }

                return army.elite();
            } catch (err) {
                $u.error("ERROR in autoElite: " + err);
                return false;
            }
        },

        /*
        autoElite: function () {
            try {
                if (!config.getItem('AutoElite', false)) {
                    return false;
                }

                if (!schedule.check('AutoEliteGetList')) {
                    if (!state.getItem('FillArmy', false) && state.getItem(caap.friendListType.giftc.name + 'Requested', false)) {
                        state.setItem(caap.friendListType.giftc.name + 'Requested', false);
                    }

                    return false;
                }

                $u.log(2, 'Elite Guard cycle');
                var mergeMyEliteTodo = function (list) {
                    $u.log(3, 'Elite Guard mergeMyEliteTodo list');
                    var eliteArmyList = config.getList('EliteArmyList', '');
                    $j.merge(eliteArmyList, army.getEliteList());
                    if ($u.hasContent(eliteArmyList)) {
                        $u.log(3, 'Merge and save Elite Guard MyEliteTodo list');
                        var diffList = list.filter(function (todoID) {
                            return !eliteArmyList.hasIndexOf(todoID);
                        });

                        $j.merge(eliteArmyList, diffList);
                        state.setItem('MyEliteTodo', eliteArmyList);
                    } else {
                        $u.log(3, 'Save Elite Guard MyEliteTodo list');
                        state.setItem('MyEliteTodo', list);
                    }
                };

                var eliteList = state.getItem('MyEliteTodo', []);
                if (!$j.isArray(eliteList)) {
                    $u.warn('MyEliteTodo list is not expected format, deleting', eliteList);
                    eliteList = state.setItem('MyEliteTodo', []);
                }

                $u.log(1, 'page', state.getItem('page', 'none'));
                if (state.getItem('page', 'none') === 'party') {
                    $u.log(1, 'Checking Elite Guard status');
                    var autoEliteFew = state.getItem('AutoEliteFew', false);
                    var autoEliteFull = /YOUR Elite Guard is FULL/i.test($j('.result_body', caap.globalContainer).text());
                    if (autoEliteFull || (autoEliteFew && state.getItem('AutoEliteEnd', '') === 'NoArmy')) {
                        if (autoEliteFull) {
                            $u.log(1, 'Elite Guard is FULL');
                            if ($u.hasContent(eliteList)) {
                                mergeMyEliteTodo(eliteList);
                            }
                        } else if (autoEliteFew && state.getItem('AutoEliteEnd', '') === 'NoArmy') {
                            $u.log(1, 'Not enough friends to fill Elite Guard');
                            state.setItem('AutoEliteFew', false);
                        }

                        $u.log(3, 'Set Elite Guard AutoEliteGetList timer');
                        schedule.setItem('AutoEliteGetList', 21600, 300);
                        state.setItem('AutoEliteEnd', 'Full');
                        $u.log(1, 'Elite Guard done');
                        return false;
                    }
                }

                if (!eliteList.length) {
                    $u.log(2, 'Elite Guard no MyEliteTodo cycle');
                    var allowPass = false;
                    if (state.getItem(caap.friendListType.giftc.name + 'Requested', false) && state.getItem(caap.friendListType.giftc.name + 'Responded', false) === true) {
                        $u.log(2, 'Elite Guard received 0 friend ids');
                        if (config.getList('EliteArmyList', '').length) {
                            $u.log(2, 'Elite Guard has some defined friend ids');
                            allowPass = true;
                        } else {
                            schedule.setItem('AutoEliteGetList', 21600, 300);
                            $u.log(2, 'Elite Guard has 0 defined friend ids');
                            state.setItem('AutoEliteEnd', 'Full');
                            $u.log(1, 'Elite Guard done');
                            return false;
                        }
                    }

                    caap.getFriendList(caap.friendListType.giftc);
                    var castleageList = [];
                    if (state.getItem(caap.friendListType.giftc.name + 'Responded', false) !== true) {
                        castleageList = state.getItem(caap.friendListType.giftc.name + 'Responded', []);
                    }

                    if ($u.hasContent(castleageList) || caap.stats['army']['capped'] <= 1 || allowPass) {
                        $u.log(2, 'Elite Guard received a new friend list');
                        mergeMyEliteTodo(castleageList);
                        state.setItem(caap.friendListType.giftc.name + 'Responded', []);
                        state.setItem(caap.friendListType.giftc.name + 'Requested', false);
                        eliteList = state.getItem('MyEliteTodo', []);
                        if ($u.hasContent(eliteList)) {
                            $u.log(1, 'WARNING! Elite Guard friend list is 0');
                            state.setItem('AutoEliteFew', true);
                            schedule.setItem('AutoEliteGetList', 21600, 300);
                        } else if (eliteList.length < 50) {
                            $u.log(1, 'WARNING! Elite Guard friend list is fewer than 50: ', eliteList.length);
                            state.setItem('AutoEliteFew', true);
                        }
                    }
                } else if (schedule.check('AutoEliteReqNext')) {
                    $u.log(2, 'Elite Guard has a MyEliteTodo list, shifting User ID');
                    var user = eliteList.shift();
                    $u.log(1, 'Add Elite Guard ID: ', user);
                    caap.clickAjaxLinkSend('party.php?twt=jneg&jneg=true&user=' + user);
                    $u.log(2, 'Elite Guard sent request, saving shifted MyEliteTodo');
                    state.setItem('MyEliteTodo', eliteList);
                    schedule.setItem('AutoEliteReqNext', 7);
                    if (!$u.hasContent(eliteList)) {
                        $u.log(2, 'Army list exhausted');
                        state.setItem('AutoEliteEnd', 'NoArmy');
                    }
                }

                $u.log(1, 'Release Elite Guard cycle');
                return true;
            } catch (err) {
                $u.error("ERROR in autoElite: " + err);
                return false;
            }
        },
        */
        /*jslint sub: false */

        /////////////////////////////////////////////////////////////////////
        //                          PASSIVE GENERALS
        /////////////////////////////////////////////////////////////////////

        passiveGeneral: function () {
            try {
                if (config.getItem('IdleGeneral', 'Use Current') !== 'Use Current') {
                    if (general.Select('IdleGeneral')) {
                        return true;
                    }
                }

                return false;
            } catch (err) {
                $u.error("ERROR in passiveGeneral: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          AUTOINCOME
        /////////////////////////////////////////////////////////////////////

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        autoIncome: function () {
            try {
                if (config.setItem("disAutoIncome", false) || (config.getItem("NoIncomeAfterLvl", true) && state.getItem('KeepLevelUpGeneral', false))) {
                    return false;
                }

                if ($u.hasContent(caap.stats['gold']['ticker']) && caap.stats['gold']['ticker'][0] < 1  && config.getItem('IncomeGeneral', 'Use Current') !== 'Use Current') {
                    general.Select('IncomeGeneral');
                    return true;
                }

                return false;
            } catch (err) {
                $u.error("ERROR in autoIncome: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        /////////////////////////////////////////////////////////////////////
        //                              ARMY
        /////////////////////////////////////////////////////////////////////

        checkResults_army: function () {
            try {
                var listHref = $j(),
                    link     = $j(),
                    autoGift = false,
                    time     = 0;

                autoGift = config.getItem('AutoGift', false);
                listHref = caap.appBodyDiv.find("div[class='messages'] a[href*='army.php?act=ignore']");
                if (listHref && listHref.length) {
                    if (autoGift) {
                        $u.log(1, 'We have a gift waiting!');
                        state.setItem('HaveGift', true);
                    }

                    listHref.each(function () {
                        var row = $j(this);
                        link = $j("<br /><a title='This link can be used to collect the " +
                            "gift when it has been lost on Facebook. !!If you accept a gift " +
                            "in this manner then it will leave an orphan request on Facebook!!' " +
                            "href='" + row.attr("href").replace('ignore', 'acpt') + "'>Lost Accept</a>");
                        link.insertAfter(row);
                    });
                } else {
                    if (autoGift) {
                        $u.log(2, 'No gifts waiting.');
                        state.setItem('HaveGift', false);
                    }
                }

                if (autoGift) {
                    time = config.getItem('CheckGiftMins', 15);
                    time = time < 15 ? 15 : time;
                    schedule.setItem("ajaxGiftCheck", time * 60, 300);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_army: " + err);
                return false;
            }
        },

        checkResults_army_member: function () {
            try {
                army.page();
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_army_member: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                              INDEX
        /////////////////////////////////////////////////////////////////////

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        checkResults_index: function () {
            try {
                function news() {
                    try {
                        if ($u.hasContent($j("#caap_news", caap.globalContainer))) {
                            return true;
                        }

                        var xp     = 0,
                            bp     = 0,
                            wp     = 0,
                            win    = 0,
                            lose   = 0,
                            deaths = 0,
                            cash   = 0,
                            i      = '',
                            list   = [],
                            user   = {},
                            tStr   = '',
                            $b     = null,
                            $c     = null;

                        $b = $j('#' + caap.domain.id[caap.domain.which] + 'battleUpdateBox');
                        if ($b && $b.length) {
                            $c = $j('.alertsContainer', $b);
                            $j('.alert_content', $c).each(function (i, el) {
                                var uid     = 0,
                                    txt     = '',
                                    my_xp   = 0,
                                    my_bp   = 0,
                                    my_wp   = 0,
                                    my_cash = 0,
                                    $a      = $j('a', el).eq(0);

                                txt = $j(el).text().replace(/,/g, '');
                                if (txt.regex(/You were killed/i)) {
                                    deaths += 1;
                                } else {
                                    tStr = $a.attr('href');
                                    uid = tStr.regex(/user=(\d+)/);
                                    user[uid] = user[uid] || {name: $a.text(), win: 0, lose: 0};
                                    my_xp = txt.regex(/(\d+) experience/i);
                                    my_bp = txt.regex(/(\d+) Battle Points!/i);
                                    my_wp = txt.regex(/(\d+) War Points!/i);
                                    my_cash = txt.regex(/\$(\d+)/i);
                                    if (txt.regex(/Victory!/i)) {
                                        win += 1;
                                        user[uid].lose += 1;
                                        xp += my_xp;
                                        bp += my_bp;
                                        wp += my_wp;
                                        cash += my_cash;
                                    } else {
                                        lose += 1;
                                        user[uid].win += 1;
                                        xp -= my_xp;
                                        bp -= my_bp;
                                        wp -= my_wp;
                                        cash -= my_cash;
                                    }
                                }
                            });

                            if (win || lose) {
                                list.push('You were challenged <strong>' + (win + lose) + '</strong> times,<br>winning <strong>' + win + '</strong> and losing <strong>' + lose + '</strong>.');
                                list.push('You ' + (xp >= 0 ? 'gained <span class="positive">' : 'lost <span class="negative">') + Math.abs(xp).addCommas() + '</span> experience points.');
                                list.push('You ' + (cash >= 0 ? 'gained <span class="positive">' : 'lost <span class="negative">') + '<b class="gold">$' + Math.abs(cash).addCommas() + '</b></span>.');
                                list.push('You ' + (bp >= 0 ? 'gained <span class="positive">' : 'lost <span class="negative">') + Math.abs(bp).addCommas() + '</span> Battle Points.');
                                list.push('You ' + (wp >= 0 ? 'gained <span class="positive">' : 'lost <span class="negative">') + Math.abs(wp).addCommas() + '</span> War Points.');
                                list.push('');
                                user = $u.sortObjectBy(user, function (a, b) {
                                        return (user[b].win + (user[b].lose / 100)) - (user[a].win + (user[a].lose / 100));
                                    });

                                for (i in user) {
                                    if (user.hasOwnProperty(i)) {
                                        list.push('<strong title="' + i + '">' + user[i].name + '</strong> ' +
                                            (user[i].win ? 'beat you <span class="negative">' + user[i].win +
                                            '</span> time' + (user[i].win > 1 ? 's' : '') : '') +
                                            (user[i].lose ? (user[i].win ? ' and ' : '') +
                                            'was beaten <span class="positive">' + user[i].lose +
                                            '</span> time' + (user[i].lose > 1 ? 's' : '') : '') + '.');
                                    }
                                }

                                if (deaths) {
                                    list.push('You died ' + (deaths > 1 ? deaths + ' times' : 'once') + '!');
                                }

                                $c.prepend('<div id="caap_news" style="padding: 0pt 0pt 10px;"><div class="alert_title">Summary:</div><div class="alert_content">' + list.join('<br>') + '</div></div>');
                            }
                        }

                        return true;
                    } catch (err) {
                        $u.error("ERROR in news: " + err);
                        return false;
                    }
                }

                if (config.getItem('NewsSummary', true)) {
                    news();
                }

                // Check for new gifts
                // A warrior wants to join your Army!
                // Send Gifts to Friends

                if (config.getItem('AutoGift', false)) {
                    if ($u.hasContent(caap.resultsText) && /Send Gifts to Friends/.test(caap.resultsText)) {
                        $u.log(1, 'We have a gift waiting!');
                        state.setItem('HaveGift', true);
                    } else {
                        $u.log(2, 'No gifts waiting.');
                        state.setItem('HaveGift', false);
                    }

                    var time = config.getItem('CheckGiftMins', 15);
                    time = time < 15 ? 15 : time;
                    schedule.setItem("ajaxGiftCheck", time * 60, 300);
                }

                //arena.index();
                return true;
            } catch (err) {
                $u.error("ERROR in checkResults_index: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        /////////////////////////////////////////////////////////////////////
        //                              AUTOGIFT
        /////////////////////////////////////////////////////////////////////

        ajaxGiftCheck: function () {
            try {
                if (config.getItem('bookmarkMode', false) || !config.getItem('AutoGift', false) || !schedule.check("ajaxGiftCheck")) {
                    return false;
                }

                function onError(XMLHttpRequest, textStatus, errorThrown) {
                    $u.error("AjaxGiftCheck.ajax", textStatus);
                }

                function onSuccess(data, textStatus, XMLHttpRequest) {
                    if ($j("a[href*='reqs.php#confirm_46755028429_0']", caap.tempAjax).length) {
                        $u.log(1, 'AjaxGiftCheck.ajax: We have a gift waiting!');
                        state.setItem('HaveGift', true);
                    } else {
                        $u.log(2, 'AjaxGiftCheck.ajax: No gifts waiting.');
                        state.setItem('HaveGift', false);
                    }
                }

                caap.ajax(caap.domain.link + '/army.php', onError, onSuccess);
                var time = config.getItem('CheckGiftMins', 15);
                time = time < 15 ? 15 : time;
                schedule.setItem("ajaxGiftCheck", time * 60, 300);
                return true;
            } catch (err) {
                $u.error("ERROR in AjaxGiftCheck: " + err);
                return false;
            }
        },

        checkResults_gift_accept: function () {
            // Confirm gifts actually sent
            gifting.queue.sent();
            gifting.collected();
        },

        GiftExceedLog: true,

        autoGift: function () {
            try {
                var tempDiv    = $j(),
                    tempText   = '',
                    giftImg    = '',
                    giftChoice = '',
                    popCheck,
                    collecting;
                    /*whenArena  = '',
                    arenaInfo  = {};

                whenArena = config.getItem("WhenArena", 'Never');
                if (whenArena !== 'Never') {
                    arenaInfo = arena.getItem();
                }*/

                /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
                /*jslint sub: true */
                if (config.getItem('bookmarkMode', false) || !config.getItem('AutoGift', false) /*|| (!$j.isEmptyObject(arenaInfo) && arenaInfo['state'] !== 'Ready')*/) {
                    return false;
                }
                /*jslint sub: false */

                popCheck = gifting.popCheck();
                if ($u.isBoolean(popCheck)) {
                    return popCheck;
                }

                // Go to gifts page if gift list is empty
                if (gifting.gifts.length() <= 2) {
                    if (caap.navigateTo('army,gift', 'tab_gifts_on.gif')) {
                        return true;
                    }
                }

                collecting = gifting.collecting();
                if ($u.isBoolean(collecting)) {
                    return collecting;
                }

                if (config.getItem("CollectOnly", false)) {
                    return false;
                }

                if (!schedule.check("NoGiftDelay")) {
                    return false;
                }

                if (!schedule.check("MaxGiftsExceeded")) {
                    if (caap.GiftExceedLog) {
                        $u.log(1, 'Gifting limit exceeded, will try later');
                        caap.GiftExceedLog = false;
                        caap.setDivContent('gifting_mess', "Max gift limit");
                    }

                    return false;
                }

                giftChoice = gifting.queue.chooseGift();
                if (gifting.queue.length() && giftChoice) {
                    if (caap.navigateTo('army,gift', 'tab_gifts_on.gif')) {
                        return true;
                    }

                    giftImg = gifting.gifts.getImg(giftChoice);
                    if (giftImg) {
                        caap.navigateTo('gift_more_gifts.gif');
                        tempDiv = $j("#" + caap.domain.id[caap.domain.which] + "giftContainer img[class='imgButton']", caap.globalContainer).eq(0);
                        if ($u.hasContent(tempDiv)) {
                            tempText = $u.setContent(tempDiv.attr("src"), '').basename();
                            if (tempText !== giftImg) {
                                $u.log(4, "images", tempText, giftImg);
                                return caap.navigateTo(giftImg);
                            }

                            $u.log(1, "Gift selected", giftChoice);
                        }
                    } else {
                        $u.log(1, "Unknown gift, using first", giftChoice);
                    }

                    if (gifting.queue.chooseFriend(gm.getItem("NumberOfGifts", 5, hiddenVar))) {
                        tempDiv = $j("form[id*='req_form_'] input[name='send']", caap.globalContainer);
                        if ($u.hasContent(tempDiv)) {
                            caap.click(tempDiv);
                            return true;
                        } else {
                            $u.warn("Send button not found!");
                            return false;
                        }
                    } else {
                        $u.log(1, "No friends chosen");
                        return false;
                    }
                }

                if ($j.isEmptyObject(gifting.getCurrent())) {
                    return false;
                }

                return true;
            } catch (err) {
                $u.error("ERROR in autoGift: " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                              IMMEDIATEAUTOSTAT
        /////////////////////////////////////////////////////////////////////

        immediateAutoStat: function () {
            if (!config.getItem("StatImmed", false) || !config.getItem('AutoStat', false)) {
                return false;
            }

            return caap.autoStat();
        },

        ////////////////////////////////////////////////////////////////////
        //                      Auto Stat
        ////////////////////////////////////////////////////////////////////

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        increaseStat: function (attribute, attrAdjust, atributeSlice) {
            try {
                attribute = attribute.toLowerCase();
                var button        = $j(),
                    level         = 0,
                    attrCurrent   = 0,
                    energy        = 0,
                    stamina       = 0,
                    attack        = 0,
                    defense       = 0,
                    health        = 0,
                    attrAdjustNew = 0,
                    energyDiv     = $j("a[href*='energy_max']", atributeSlice),
                    staminaDiv    = $j("a[href*='stamina_max']", atributeSlice),
                    attackDiv     = $j("a[href*='attack']", atributeSlice),
                    defenseDiv    = $j("a[href*='defense']", atributeSlice),
                    healthDiv     = $j("a[href*='health_max']", atributeSlice),
                    logTxt        = "";

                /*
                if (caap.waitingAjaxLoad()) {
                    $u.warn("Unable to find AjaxLoadIcon or page not loaded: Fail");
                    return "Fail";
                }
                */

                switch (attribute) {
                case "energy" :
                    button = energyDiv;
                    break;
                case "stamina" :
                    button = staminaDiv;
                    break;
                case "attack" :
                    button = attackDiv;
                    break;
                case "defense" :
                    button = defenseDiv;
                    break;
                case "health" :
                    button = healthDiv;
                    break;
                default :
                    throw "Unable to match attribute: " + attribute;
                }

                if (!$u.hasContent(button)) {
                    $u.warn("Unable to locate upgrade button: Fail ", attribute);
                    return "Fail";
                }

                attrAdjustNew = attrAdjust;
                logTxt = attrAdjust;
                level = caap.stats['level'];
                function getValue(div) {
                    return $u.setContent($j("div[class='attribute_stat_container']", div.parent().parent()).text(), '').regex(/(\d+)/);
                }

                attrCurrent = getValue(button);
                energy = getValue(energyDiv);
                stamina = getValue(staminaDiv);
                if (level >= 10) {
                    attack = getValue(attackDiv);
                    defense = getValue(defenseDiv);
                    health = getValue(healthDiv);
                }

                if (config.getItem('AutoStatAdv', false)) {
                    //Using eval, so user can define formulas on menu, like energy = level + 50
                    /*jslint evil: true */
                    attrAdjustNew = eval(attrAdjust);
                    /*jslint evil: false */
                    logTxt = "(" + attrAdjust + ")=" + attrAdjustNew;
                }

                if ((attribute === 'stamina') && (caap.stats['points']['skill'] < 2)) {
                    if (attrAdjustNew <= attrCurrent) {
                        $u.log(2, "Stamina at requirement: Next");
                        return "Next";
                    } else if (config.getItem("StatSpendAll", false)) {
                        $u.log(2, "Stamina requires 2 upgrade points: Next");
                        return "Next";
                    } else {
                        $u.log(2, "Stamina requires 2 upgrade points: Save");
                        state.setItem("statsMatch", false);
                        return "Save";
                    }
                }

                if (attrAdjustNew > attrCurrent) {
                    $u.log(2, "Status Before [" + attribute + "=" + attrCurrent + "]  Adjusting To [" + logTxt + "]");
                    caap.click(button);
                    return "Click";
                }

                return "Next";
            } catch (err) {
                $u.error("ERROR in increaseStat: " + err);
                return "Error";
            }
        },

        autoStatCheck: function () {
            try {
                var startAtt   = 0,
                    stopAtt    = 4,
                    attribute  = '',
                    attrValue  = 0,
                    n          = 0,
                    level      = 0,
                    energy     = 0,
                    stamina    = 0,
                    attack     = 0,
                    defense    = 0,
                    health     = 0,
                    attrAdjust = 0,
                    value      = 0,
                    passed     = false;

                if (!config.getItem('AutoStat', false) || !caap.stats['points']['skill']) {
                    return false;
                }

                if (config.getItem("AutoStatAdv", false)) {
                    startAtt = 5;
                    stopAtt = 9;
                }

                for (n = startAtt; n <= stopAtt; n += 1) {
                    attribute = config.getItem('Attribute' + n, '').toLowerCase();
                    if (attribute === '') {
                        continue;
                    }

                    if (caap.stats['level'] < 10) {
                        if (attribute === 'attack' || attribute === 'defense' || attribute === 'health') {
                            continue;
                        }
                    }

                    attrValue = config.getItem('AttrValue' + n, 0);
                    attrAdjust = attrValue;
                    level = caap.stats['level'];
                    energy = caap.stats['energy']['num'];
                    stamina = caap.stats['stamina']['num'];
                    if (level >= 10) {
                        attack = caap.stats['attack'];
                        defense = caap.stats['defense'];
                        health = caap.stats['health']['num'];
                    }

                    if (config.getItem('AutoStatAdv', false)) {
                        //Using eval, so user can define formulas on menu, like energy = level + 50
                        /*jslint evil: true */
                        attrAdjust = eval(attrValue);
                        /*jslint evil: false */
                    }

                    if (attribute === "attack" || attribute === "defense") {
                        value = caap.stats[attribute];
                    } else {
                        value = caap.stats[attribute]['num'];
                    }

                    if (attribute === 'stamina' && caap.stats['points']['skill'] < 2) {
                        if (config.getItem("StatSpendAll", false) && attrAdjust > value) {
                            continue;
                        } else {
                            passed = false;
                            break;
                        }
                    }

                    if (attrAdjust > value) {
                        passed = true;
                        break;
                    }
                }

                state.setItem("statsMatch", passed);
                return true;
            } catch (err) {
                $u.error("ERROR in autoStatCheck: " + err);
                return false;
            }
        },

        autoStat: function () {
            try {
                if (!config.getItem('AutoStat', false) || !caap.stats['points']['skill']) {
                    return false;
                }

                if (!state.getItem("statsMatch", true)) {
                    if (state.getItem("autoStatRuleLog", true)) {
                        $u.log(2, "User should possibly change their stats rules");
                        state.setItem("autoStatRuleLog", false);
                    }

                    return false;
                }

                var atributeSlice      = $j("div[class*='keep_attribute_section']", caap.appBodyDiv),
                    startAtt           = 0,
                    stopAtt            = 4,
                    attrName           = '',
                    attribute          = '',
                    attrValue          = 0,
                    n                  = 0,
                    returnIncreaseStat = '';

                if (!$u.hasContent(atributeSlice)) {
                    caap.navigateTo('keep');
                    return true;
                }

                if (config.getItem("AutoStatAdv", false)) {
                    startAtt = 5;
                    stopAtt = 9;
                }

                for (n = startAtt; n <= stopAtt; n += 1) {
                    attrName = 'Attribute' + n;
                    attribute = config.getItem(attrName, '');
                    if (attribute === '') {
                        $u.log(4, attrName + " is blank: continue");
                        continue;
                    }

                    if (caap.stats['level'] < 10) {
                        if (attribute === 'Attack' || attribute === 'Defense' || attribute === 'Health') {
                            $u.log(1, "Characters below level 10 can not increase Attack, Defense or Health: continue");
                            continue;
                        }
                    }

                    attrValue = config.getItem('AttrValue' + n, 0);
                    returnIncreaseStat = caap.increaseStat(attribute, attrValue, atributeSlice);
                    switch (returnIncreaseStat) {
                    case "Next" :
                        $u.log(4, attrName + " : next");
                        continue;
                    case "Click" :
                        $u.log(4, attrName + " : click");
                        return true;
                    default :
                        $u.log(4, attrName + " return value: " + returnIncreaseStat);
                        return false;
                    }
                }

                $u.log(1, "No rules match to increase stats");
                state.setItem("statsMatch", false);
                return false;
            } catch (err) {
                $u.error("ERROR in autoStat: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        /////////////////////////////////////////////////////////////////////
        //                              CTA
        /////////////////////////////////////////////////////////////////////

        waitAjaxCTA: false,

        recordCTA: [],

        loadedCTA: false,

        waitLoadCTA: true,

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        doCTAs: function () {
            try {
                if (gm.getItem("ajaxCTA", false, hiddenVar) || caap.waitAjaxCTA || caap.stats['stamina']['num'] < 1 || !schedule.check('ajaxCTATimer')) {
                    return false;
                }

                if (caap.waitLoadCTA) {
                    $j.ajax({
                        url: "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20csv%20where%20url%3D'http%3A%2F%2Fspreadsheets.google.com%2Fpub%3Fkey%3D0At1LY6Vd3Bp9dFhvYkltNVdVNlRfSzZWV0xCQXQtR3c%26hl%3Den%26output%3Dcsv'&format=json",
                        dataType: ($u.is_opera ? "jsonp" : "json"),
                        error: function () {
                            caap.loadedCTA = true;
                        },
                        success: function (msg) {
                            var rows       = msg['query']['results']['row'],
                                row        = 0,
                                rowsLen    = 0,
                                column     = 0,
                                newRecord  = {},
                                headers    = rows[0],
                                headersLen = 0,
                                headersArr = [],
                                key        = '';

                            for (key in headers) {
                                if (headers.hasOwnProperty(key)) {
                                    headersLen = headersArr.push((headers[key]).toLowerCase());
                                }
                            }

                            for (row = 1, rowsLen = rows.length; row < rowsLen; row += 1) {
                                newRecord = {};
                                for (column = 0; column < headersLen; column += 1) {
                                    if (!$u.hasContent(headersArr[column])) {
                                        continue;
                                    }

                                    newRecord[headersArr[column]] = $u.setContent(rows[row]["col" + column], null);
                                }

                                caap.recordCTA.push(newRecord);
                            }

                            caap.loadedCTA = true;
                        }
                    });

                    caap.waitLoadCTA = false;
                    return true;
                }

                if (!$u.hasContent(caap.recordCTA) || !caap.loadedCTA) {
                    return false;
                }

                var count = state.getItem('ajaxCTACount', 0),
                    aes   = null;

                if (count < caap.recordCTA.length) {
                    caap.waitAjaxCTA = true;
                    aes = new $u.Aes(gm.get_namespace());
                    $j.ajax({
                        url: caap.domain.link + aes.decrypt(caap.recordCTA[count]['code']),
                        error: function () {
                            caap.waitAjaxCTA = false;
                        },
                        success: function () {
                            caap.waitAjaxCTA = false;
                        }
                    });

                    count = state.setItem('ajaxCTACount', count + 1);
                    $u.log(10, "doCTAs", count, caap.recordCTA.length);
                } else {
                    caap.waitAjaxCTA = false;
                    state.setItem('ajaxCTACount', 0);
                    schedule.setItem('ajaxCTATimer', 10800, 300);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in doCTAs: " + err);
                return false;
            }
        },
        /*jslint sub: false */

        /////////////////////////////////////////////////////////////////////
        //                              FRIEND LISTS
        /////////////////////////////////////////////////////////////////////

        friendListType: {
            facebook: {
                name: "facebook",
                url: '/army.php?app_friends=false&giftSelection=1'
            },
            gifta: {
                name: "gifta",
                url: '/gift.php?app_friends=a&giftSelection=1'
            },
            giftb: {
                name: "giftb",
                url: '/gift.php?app_friends=b&giftSelection=1'
            },
            giftc: {
                name: "giftc",
                url: '/gift.php?app_friends=c&giftSelection=1'
            }
        },

        /*
        getFriendList: function (listType, force) {
            try {
                $u.log(4, "Entered getFriendList and request is for: ", listType.name);
                if (force === true) {
                    state.setItem(listType.name + 'Requested', false);
                    state.setItem(listType.name + 'Responded', []);
                }

                function onError(XMLHttpRequest, textStatus, errorThrown) {
                    state.setItem(listType.name + 'Requested', false);
                    $u.error("getFriendList(" + listType.name + "): ", textStatus);
                }

                function onSuccess(data, textStatus, XMLHttpRequest) {
                    var friendList = [];
                    $j("div[class='unselected_list'] input", caap.tempAjax).each(function () {
                        friendList.push($j(this).val().parseInt());
                    });

                    $u.log(2, "getFriendList.ajax saving friend list of: ", friendList.length);
                    state.setItem(listType.name + 'Responded', $u.setContent(friendList, true));
                }

                if (!state.getItem(listType.name + 'Requested', false)) {
                    $u.log(3, "Getting Friend List: ", listType.name);
                    state.setItem(listType.name + 'Requested', true);
                    if (caap.domain.which > 1) {
                        var armyList = army.getIdList();
                        $u.log(3, "armyList", armyList);
                        state.setItem(listType.name + 'Responded', listType.name === "giftc" && $u.hasContent(armyList) ? armyList : true);
                    } else {
                        caap.ajax(caap.domain.link + listType.url, onError, onSuccess);
                    }
                } else {
                    $u.log(4, "Already requested getFriendList for: ", listType.name);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in getFriendList(" + listType.name + "): " + err);
                return false;
            }
        },
        */

        getFriendList: function (listType, force) {
            try {
                $u.log(4, "Entered getFriendList and request is for: ", listType.name);
                if (force === true) {
                    state.setItem(listType.name + 'Requested', false);
                    state.setItem(listType.name + 'Responded', []);
                }

                function onError(XMLHttpRequest, textStatus, errorThrown) {
                    state.setItem(listType.name + 'Requested', false);
                    $u.error("getFriendList(" + listType.name + "): ", textStatus);
                }

                function onSuccess(data, textStatus, XMLHttpRequest) {
                    var friendList = [];
                    $j("div[class='unselected_list'] input", caap.tempAjax).each(function () {
                        friendList.push($j(this).val().parseInt());
                    });

                    $u.log(2, "getFriendList.ajax saving friend list of: ", friendList.length);
                    state.setItem(listType.name + 'Responded', $u.setContent(friendList, true));
                }

                if (!state.getItem(listType.name + 'Requested', false)) {
                    $u.log(3, "Getting Friend List: ", listType.name);
                    state.setItem(listType.name + 'Requested', true);
                    if (caap.domain.which > 1) {
                        var armyList = army.getIdList();
                        $u.log(3, "armyList", armyList);
                        state.setItem(listType.name + 'Responded', listType.name === "giftc" && $u.hasContent(armyList) ? armyList : true);
                    } else {
                        caap.ajax(caap.domain.link + listType.url, onError, onSuccess);
                    }
                } else {
                    $u.log(4, "Already requested getFriendList for: ", listType.name);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in getFriendList(" + listType.name + "): " + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                              FILL ARMY
        /////////////////////////////////////////////////////////////////////

        addFriendSpamCheck: 0,

        autoFillArmy: function (caListType, fbListType) {
            try {
                if (!state.getItem('FillArmy', false) || caap.domain.which > 1) {
                    return false;
                }

                function addFriend(id) {
                    try {
                        function responseCallback(data, textStatus, XMLHttpRequest) {
                            if (caap.addFriendSpamCheck > 0) {
                                caap.addFriendSpamCheck -= 1;
                            }

                            $u.log(1, "AddFriend(" + id + "): ", textStatus);
                        }

                        caap.ajax(caap.domain.link + '/party.php?twt=jneg&jneg=true&user=' + id + '&lka=' + id + '&etw=9&ref=nf', responseCallback, responseCallback);
                        return true;
                    } catch (err) {
                        $u.error("ERROR in addFriend(" + id + "): " + err);
                        return false;
                    }
                }

                var armyCount = state.getItem("ArmyCount", 0);
                if (armyCount === 0) {
                    caap.setDivContent('idle_mess', 'Filling Army');
                    $u.log(1, "Filling army");
                }

                if (state.getItem(caListType.name + 'Responded', false) === true || state.getItem(fbListType.name + 'Responded', false) === true) {
                    caap.setDivContent('idle_mess', '<span style="font-weight: bold;">Fill Army Completed</span>');
                    $u.log(1, "Fill Army Completed: no friends found");
                    window.setTimeout(function () {
                        caap.setDivContent('idle_mess', '');
                    }, 5000);

                    state.setItem('FillArmy', false);
                    state.setItem("ArmyCount", 0);
                    state.setItem('FillArmyList', []);
                    state.setItem(caListType.name + 'Responded', false);
                    state.setItem(fbListType.name + 'Responded', false);
                    state.setItem(caListType.name + 'Requested', []);
                    state.setItem(fbListType.name + 'Requested', []);
                    return true;
                }

                var fillArmyList = state.getItem('FillArmyList', []);
                if (!fillArmyList.length) {
                    caap.getFriendList(caListType);
                    caap.getFriendList(fbListType);
                }

                var castleageList = state.getItem(caListType.name + 'Responded', []);
                $u.log(4, "gifList: ", castleageList);
                var facebookList = state.getItem(fbListType.name + 'Responded', []);
                $u.log(4, "facebookList: ", facebookList);
                if ((castleageList.length && facebookList.length) || fillArmyList.length) {
                    if (!fillArmyList.length) {
                        var diffList = facebookList.filter(function (facebookID) {
                            return castleageList.hasIndexOf(facebookID);
                        });

                        $u.log(4, "diffList: ", diffList);
                        fillArmyList = state.setItem('FillArmyList', diffList);
                        state.setItem(caListType.name + 'Responded', false);
                        state.setItem(fbListType.name + 'Responded', false);
                        state.setItem(caListType.name + 'Requested', []);
                        state.setItem(fbListType.name + 'Requested', []);
                    }

                    // Add army members //
                    var batchCount = 5;
                    if (fillArmyList.length < 5) {
                        batchCount = fillArmyList.length;
                    } else if (fillArmyList.length - armyCount < 5) {
                        batchCount = fillArmyList.length - armyCount;
                    }

                    batchCount = batchCount - caap.addFriendSpamCheck;
                    for (var i = 0; i < batchCount; i += 1) {
                        addFriend(fillArmyList[armyCount]);
                        armyCount += 1;
                        caap.addFriendSpamCheck += 1;
                    }

                    caap.setDivContent('idle_mess', 'Filling Army, Please wait...' + armyCount + "/" + fillArmyList.length);
                    $u.log(1, 'Filling Army, Please wait...' + armyCount + "/" + fillArmyList.length);
                    state.setItem("ArmyCount", armyCount);
                    if (armyCount >= fillArmyList.length) {
                        caap.setDivContent('idle_mess', '<span style="font-weight: bold;">Fill Army Completed</span>');
                        window.setTimeout(function () {
                            caap.setDivContent('idle_mess', '');
                        }, 5000);

                        $u.log(1, "Fill Army Completed");
                        state.setItem('FillArmy', false);
                        state.setItem("ArmyCount", 0);
                        state.setItem('FillArmyList', []);
                    }
                }

                return true;
            } catch (err) {
                $u.error("ERROR in autoFillArmy: " + err);
                caap.setDivContent('idle_mess', '<span style="font-weight: bold;">Fill Army Failed</span>');
                window.setTimeout(function () {
                    caap.setDivContent('idle_mess', '');
                }, 5000);

                state.setItem('FillArmy', false);
                state.setItem("ArmyCount", 0);
                state.setItem('FillArmyList', []);
                state.setItem(caListType.name + 'Responded', false);
                state.setItem(fbListType.name + 'Responded', false);
                state.setItem(caListType.name + 'Requested', []);
                state.setItem(fbListType.name + 'Requested', []);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                              IDLE
        /////////////////////////////////////////////////////////////////////

        idle: function () {
            if (state.getItem('resetselectMonster', false)) {
                $u.log(4, "resetselectMonster");
                monster.select(true);
                state.setItem('resetselectMonster', false);
            }

            if (state.getItem('resetselectGuildMonster', false)) {
                $u.log(4, "resetselectGuildMonster");
                guild_monster.select(true);
                state.setItem('resetselectGuildMonster', false);
            }

            if (caap.doCTAs()) {
                return true;
            }

            caap.autoFillArmy(caap.friendListType.giftc, caap.friendListType.facebook);
            caap.updateDashboard();
            state.setItem('ReleaseControl', true);
            return true;
        },

        /////////////////////////////////////////////////////////////////////
        //                              PLAYER RECON
        /////////////////////////////////////////////////////////////////////

        /*-------------------------------------------------------------------------------------\
                                          RECON PLAYERS
        reconPlayers is an idle background process that scans the battle page for viable
        targets that can later be attacked.
        \-------------------------------------------------------------------------------------*/

        reconRecords : [],

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        reconRecord: function () {
            this.data = {
                'userID'          : 0,
                'nameStr'         : '',
                'rankNum'         : 0,
                'warRankNum'      : 0,
                'levelNum'        : 0,
                'armyNum'         : 0,
                'deityNum'        : 0,
                'aliveTime'       : 0
            };
        },
        /*jslint sub: false */

        reconhbest: 2,

        loadRecon: function () {
            caap.reconRecords = gm.getItem('recon.records', 'default');
            if (caap.reconRecords === 'default' || !$j.isArray(caap.reconRecords)) {
                caap.reconRecords = gm.setItem('recon.records', []);
            }

            caap.reconhbest = caap.reconhbest === false ? JSON.hbest(caap.reconRecords) : caap.reconhbest;
            $u.log(3, "recon.records Hbest", caap.reconhbest);
            state.setItem("ReconDashUpdate", true);
            $u.log(3, "recon.records", caap.reconRecords);
        },

        saveRecon: function () {
            var compress = false;
            gm.setItem('recon.records', caap.reconRecords, caap.reconhbest, compress);
            state.setItem("ReconDashUpdate", true);
            $u.log(3, "recon.records", caap.reconRecords);
        },

        /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
        /*jslint sub: true */
        reconPlayers: function () {
            try {
                if (!config.getItem('DoPlayerRecon', false) || !schedule.check('PlayerReconTimer') || caap.stats['stamina']['num'] <= 0) {
                    return false;
                }

                caap.setDivContent('idle_mess', 'Player Recon: In Progress');
                $u.log(1, "Player Recon: In Progress");

                function onError(XMLHttpRequest, textStatus, errorThrown) {
                    $u.error("ReconPlayers.ajax", textStatus);
                }

                function onSuccess(data, textStatus, XMLHttpRequest) {
                    $u.log(3, "reconPlayers", [data, textStatus, XMLHttpRequest]);
                    var found       = 0,
                        regex       = new RegExp('(.+)\\s*\\(Level (\\d+)\\)\\s*Battle: ([A-Za-z ]+) \\(Rank (\\d+)\\)\\s*War: ([A-Za-z ]+) \\(Rank (\\d+)\\)\\s*(\\d+)', 'i'),
                        regex2      = new RegExp('(.+)\\s*\\(Level (\\d+)\\)\\s*Battle: ([A-Za-z ]+) \\(Rank (\\d+)\\)\\s*(\\d+)', 'i'),
                        entryLimit  = config.getItem('LimitTargets', 100),
                        reconRank   = config.getItem('ReconPlayerRank', 99),
                        reconLevel  = config.getItem('ReconPlayerLevel', 999),
                        reconARBase = config.getItem('ReconPlayerARBase', 999);

                    $u.log(3, "reconPlayers.ajax: Checking data.");

                    $j("img[src*='symbol_']", caap.tempAjax).not("img[src*='symbol_tiny_']", caap.tempAjax).each(function (index) {
                        var UserRecord      = new caap.reconRecord(),
                            row             = $j(this),
                            $tempObj        = row.parent().parent().parent().parent().parent(),
                            tempArray       = [],
                            txt             = '',
                            i               = 0,
                            OldRecord       = {},
                            levelMultiplier = 0,
                            armyRatio       = 0,
                            goodTarget      = true,
                            len             = 0;

                        if ($tempObj.length) {
                            UserRecord.data['userID'] = $u.setContent($j("a", $tempObj).eq(0).attr("href").regex(/user=(\d+)/), 0);
                            if (!$u.hasContent(UserRecord.data['userID']) || UserRecord.data['userID'] <= 0) {
                                $u.log(2, "reconPlayers: No userId, skipping");
                                return true;
                            }

                            for (i = 0, len = caap.reconRecords.length; i < len; i += 1) {
                                if (caap.reconRecords[i]['userID'] === UserRecord.data['userID']) {
                                    UserRecord.data = caap.reconRecords[i];
                                    caap.reconRecords.splice(i, 1);
                                    $u.log(3, "UserRecord exists. Loaded and removed.", UserRecord);
                                    break;
                                }
                            }

                            UserRecord.data['deityNum'] = $u.setContent(row.attr("src").regex(/symbol_(\d)\.jpg/), 1);
                            txt = $u.setContent($tempObj.text(), '').trim();
                            if (txt.length) {
                                if (battle.battles['Freshmeat']['warLevel']) {
                                    tempArray = regex.exec(txt);
                                    if (!tempArray) {
                                        tempArray = regex2.exec(txt);
                                        battle.battles['Freshmeat']['warLevel'] = false;
                                    }
                                } else {
                                    tempArray = regex2.exec(txt);
                                    if (!tempArray) {
                                        tempArray = regex.exec(txt);
                                        battle.battles['Freshmeat']['warLevel'] = true;
                                    }
                                }

                                if (tempArray) {
                                    UserRecord.data['aliveTime']      = new Date().getTime();
                                    UserRecord.data['nameStr']        = tempArray[1] ? tempArray[1].trim() : '';
                                    UserRecord.data['levelNum']       = tempArray[2] ? tempArray[2].parseInt() : 0;
                                    UserRecord.data['rankNum']        = tempArray[4] ? tempArray[4].parseInt() : 0;
                                    if (battle.battles['Freshmeat']['warLevel']) {
                                        UserRecord.data['warRankNum'] = tempArray[6] ? tempArray[6].parseInt() : 0;
                                        UserRecord.data['armyNum']    = tempArray[7] ? tempArray[7].parseInt() : 0;
                                    } else {
                                        UserRecord.data['armyNum']    = tempArray[5] ? tempArray[5].parseInt() : 0;
                                    }

                                    if (UserRecord.data['levelNum'] - caap.stats['level'] > reconLevel) {
                                        $u.log(3, 'Level above reconLevel max', reconLevel, UserRecord);
                                        goodTarget = false;
                                    } else if (caap.stats['rank']['battle'] - UserRecord.data['rankNum'] > reconRank) {
                                        $u.log(3, 'Rank below reconRank min', reconRank, UserRecord);
                                        goodTarget = false;
                                    } else {
                                        levelMultiplier = caap.stats['level'] / UserRecord.data['levelNum'];
                                        armyRatio = reconARBase * levelMultiplier;
                                        if (armyRatio <= 0) {
                                            $u.log(3, 'Recon unable to calculate army ratio', reconARBase, levelMultiplier);
                                            goodTarget = false;
                                        } else if (UserRecord.data['armyNum']  > (caap.stats['army']['capped'] * armyRatio)) {
                                            $u.log(3, 'Army above armyRatio adjustment', armyRatio, UserRecord);
                                            goodTarget = false;
                                        }
                                    }

                                    if (goodTarget) {
                                        while (caap.reconRecords.length >= entryLimit) {
                                            OldRecord = caap.reconRecords.shift();
                                            $u.log(3, "Entry limit matched. Deleted an old record", OldRecord);
                                        }

                                        $u.log(3, "UserRecord", UserRecord);
                                        caap.reconRecords.push(UserRecord.data);
                                        found += 1;
                                    }
                                } else {
                                    $u.warn('Recon can not parse target text string', txt);
                                }
                            } else {
                                $u.warn("Can't find txt in $tempObj", $tempObj);
                            }
                        } else {
                            $u.warn("$tempObj is empty");
                        }

                        return true;
                    });

                    caap.saveRecon();
                    caap.setDivContent('idle_mess', 'Player Recon: Found:' + found + ' Total:' + caap.reconRecords.length);
                    $u.log(1, 'Player Recon: Found:' + found + ' Total:' + caap.reconRecords.length);
                    window.setTimeout(function () {
                        caap.setDivContent('idle_mess', '');
                    }, 5000);

                    $u.log(4, "reconPlayers.ajax: Done.", caap.reconRecords);
                }

                caap.ajax(caap.domain.link + '/battle.php', onError, onSuccess);
                schedule.setItem('PlayerReconTimer', gm.getItem('PlayerReconRetry', 60, hiddenVar), 60);
                return true;
            } catch (err) {
                $u.error("ERROR in reconPlayers:" + err);
                return false;
            }
        },

        /////////////////////////////////////////////////////////////////////
        //                          MAIN LOOP
        // This function repeats continously.  In principle, functions should only make one
        // click before returning back here.
        /////////////////////////////////////////////////////////////////////

        actionDescTable: {
            'autoIncome'            : 'Awaiting Income',
            'autoStat'              : 'Upgrade Skill Points',
            'maxEnergyQuest'        : 'At Max Energy Quest',
            'passiveGeneral'        : 'Setting Idle General',
            'idle'                  : 'Idle Tasks',
            'immediateBanking'      : 'Immediate Banking',
            'battle'                : 'Battling Players',
            'monsterReview'         : 'Review Monsters/Raids',
            'guildMonsterReview'    : 'Review Guild Monsters',
            'immediateAutoStat'     : 'Immediate Auto Stats',
            'autoElite'             : 'Fill Elite Guard',
            'autoPotions'           : 'Auto Potions',
            'autoAlchemy'           : 'Auto Alchemy',
            'autoBless'             : 'Auto Bless',
            'autoGift'              : 'Auto Gifting',
            'demiPoints'            : 'Demi Points First',
            'monsters'              : 'Fighting Monsters',
            'guildMonster'          : 'Fight Guild Monster',
            'heal'                  : 'Auto Healing',
            'bank'                  : 'Auto Banking',
            'lands'                 : 'Land Operations',
            'quests'                : 'Questing',
            'checkGenerals'         : 'Checking Generals',
            'checkAllGenerals'      : 'Getting Generals Stats',
            'checkArmy'             : 'Checking Army',
            'checkKeep'             : 'Checking Keep',
            'ajaxGiftCheck'         : 'Ajax Gift Check',
            'ajaxCheckFeed'         : 'Ajax Feed Check',
            'feedScan'              : 'Scanning Monsters',
            'checkAchievements'     : 'Achievements',
            'reconPlayers'          : 'Player Recon',
            'checkOracle'           : 'Checking Oracle',
            'checkBattleRank'       : 'Battle Rank',
            'checkWarRank'          : 'War Rank',
            'checkSymbolQuests'     : 'Demi Blessing Stats',
            'checkSoldiers'         : 'Getting Soldiers',
            'checkItem'             : 'Getting Items',
            'checkMagic'            : 'Getting Magic',
            'checkCharacterClasses' : 'Character Classes',
            'festivalBless'         : 'Festival Feats'
        },
        /*jslint sub: false */

        checkLastAction: function (thisAction) {
            try {
                var lastAction = state.getItem('LastAction', 'idle');
                caap.setDivContent('activity_mess', 'Activity: ' + $u.setContent(caap.actionDescTable[thisAction], thisAction));

                if (lastAction !== thisAction) {
                    $u.log(1, 'Changed from doing ' + lastAction + ' to ' + thisAction);
                    state.setItem('LastAction', thisAction);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in checkLastAction:" + err);
                return false;
            }
        },

        masterActionList: {
            0x00: 'autoElite',
            0x01: 'heal',
            0x02: 'immediateBanking',
            0x03: 'immediateAutoStat',
            0x04: 'maxEnergyQuest',
            //0x05: 'arenaReview',
            0x05: 'festivalReview',
            0x06: 'guildMonsterReview',
            0x07: 'monsterReview',
            //0x08: 'arena',
            0x08: 'festival',
            0x09: 'guildMonster',
            0x0A: 'demiPoints',
            0x0B: 'monsters',
            0x0C: 'battle',
            0x0D: 'quests',
            0x0E: 'bank',
            0x0F: 'passiveGeneral',
            0x10: 'checkGenerals',
            0x11: 'checkAllGenerals',
            0x12: 'checkArmy',
            0x13: 'lands',
            0x14: 'autoBless',
            0x15: 'autoStat',
            0x16: 'autoGift',
            0x17: 'checkKeep',
            0x18: 'autoPotions',
            0x19: 'autoAlchemy',
            0x1A: 'checkAchievements',
            0x1B: 'ajaxGiftCheck',
            0x1C: 'reconPlayers',
            0x1D: 'checkOracle',
            0x1E: 'checkBattleRank',
            0x1F: 'checkWarRank',
            0x20: 'checkSymbolQuests',
            0x21: 'checkSoldiers',
            0x22: 'checkItem',
            0x23: 'checkMagic',
            0x24: 'checkCharacterClasses',
            0x25: 'festivalBless',
            0x26: 'ajaxCheckFeed',
            0x27: 'ajaxCheckGuild',
            0x28: 'ajaxCheckPublic1',
            0x29: 'ajaxCheckPublic2',
            0x2A: 'ajaxCheckPublic3',
            0x2B: 'feedScan',
            0x2C: 'idle'
        },

        actionsList: [],

        makeActionsList: function () {
            try {
                if (!$u.hasContent(caap.actionsList)) {
                    $u.log(2, "Loading a fresh Action List");
                    // actionOrder is a comma seperated string of action numbers as
                    // hex pairs and can be referenced in the Master Action List
                    // Example: "00,01,02,03,04,05,06,07,08,09,0A,0B,0C,0D,0E,0F,10,11,12"
                    var action                = '',
                        actionOrderArray      = [],
                        masterActionListCount = 0,
                        actionOrderUser       = config.getItem("actionOrder", ''),
                        actionOrderArrayCount = 0,
                        itemCount             = 0,
                        actionItem            = '';

                    if ($u.hasContent(actionOrderUser)) {
                        // We are using the user defined actionOrder set in the
                        // Advanced Hidden Options
                        $u.log(2, "Trying user defined Action Order");
                        // We take the User Action Order and convert it from a comma
                        // separated list into an array
                        actionOrderArray = actionOrderUser.split(",");
                        // We count the number of actions contained in the
                        // Master Action list
                        for (action in caap.masterActionList) {
                            if (caap.masterActionList.hasOwnProperty(action)) {
                                masterActionListCount += 1;
                                $u.log(4, "Counting Action List", masterActionListCount);
                            } else {
                                $u.warn("Error Getting Master Action List length!");
                                $u.warn("Skipping 'action' from masterActionList: ", action);
                            }
                        }
                    } else {
                        // We are building the Action Order Array from the
                        // Master Action List
                        $u.log(2, "Building the default Action Order");
                        for (action in caap.masterActionList) {
                            if (caap.masterActionList.hasOwnProperty(action)) {
                                masterActionListCount = actionOrderArray.push(action);
                                $u.log(4, "Action Added", action);
                            } else {
                                $u.warn("Error Building Default Action Order!");
                                $u.warn("Skipping 'action' from masterActionList: ", action);
                            }
                        }
                    }

                    // We notify if the number of actions are not sensible or the
                    // same as in the Master Action List
                    actionOrderArrayCount = actionOrderArray.length;
                    if (actionOrderArrayCount === 0) {
                        throw "Action Order Array is empty! " + (actionOrderUser === "" ? "(Default)" : "(User)");
                    } else if (actionOrderArrayCount < masterActionListCount) {
                        $u.warn("Warning! Action Order Array has fewer orders than default!");
                    } else if (actionOrderArrayCount > masterActionListCount) {
                        $u.warn("Warning! Action Order Array has more orders than default!");
                    }

                    // We build the Action List
                    $u.log(8, "Building Action List ...");
                    for (itemCount = 0; itemCount !== actionOrderArrayCount; itemCount += 1) {
                        actionItem = '';
                        if ($u.hasContent(actionOrderUser)) {
                            // We are using the user defined comma separated list of hex pairs
                            actionItem = caap.masterActionList[actionOrderArray[itemCount].parseInt(16)];
                            $u.log(4, "(" + itemCount + ") Converted user defined hex pair to action", actionItem);
                        } else {
                            // We are using the Master Action List
                            actionItem = caap.masterActionList[actionOrderArray[itemCount]];
                            $u.log(4, "(" + itemCount + ") Converted Master Action List entry to an action", actionItem);
                        }

                        // Check the Action Item
                        if ($u.hasContent(actionItem)) {
                            // We add the Action Item to the Action List
                            caap.actionsList.push(actionItem);
                            $u.log(4, "Added action to the list", actionItem);
                        } else {
                            $u.warn("Error! Skipping actionItem");
                            $u.warn("Action Item(" + itemCount + "): ", actionItem);
                        }
                    }

                    if ($u.hasContent(actionOrderUser)) {
                        $u.log(1, "Get Action List: ", caap.actionsList);
                    }
                }

                return true;
            } catch (err) {
                // Something went wrong, log it and use the emergency Action List.
                $u.error("ERROR in makeActionsList: " + err);
                for (var jt in caap.masterActionList) {
                    if (caap.masterActionList.hasOwnProperty(jt)) {
                        caap.actionsList.push(caap.masterActionList[jt]);
                    }
                }

                return false;
            }
        },

        errorCheckWait: false,

        errorCheck: function () {
            // assorted errors...
            if (caap.errorCheckWait) {
                return true;
            }

            if (window.location.href.hasIndexOf('/error.html') || window.location.href.hasIndexOf('/sorry.php')) {
                $u.warn('Detected "error" or "sorry" page, waiting to go back to previous page.');
                window.setTimeout(function () {
                    if ($u.isFunction(window.history.back)) {
                        window.history.back();
                    } else if ($u.isFunction(window.history.go)) {
                        window.history.go(-1);
                    } else {
                        window.location.href = 'http://apps.facebook.com/castle_age/index.php?bm=1&ref=bookmarks&count=0';
                    }
                }, 60000);

                caap.errorCheckWait = true;
                return true;
            }

            // Try again button
            var button = $j("#try_again_button, input[name='try_again_button']");
            if ($u.hasContent(button)) {
                $u.warn('Detected "Try Again" message, clicking button else refresh.');
                $j(".phl").append("<p>CAAP will retry shortly!</p>");
                window.setTimeout(function () {
                    caap.click(button);
                    window.setTimeout(function () {
                        $u.reload();
                    }, 180000);
                }, 60000 + (Math.floor(Math.random() * 60) * 1000));

                caap.errorCheckWait = true;
                return true;
            }

            return false;
        },

        waitingAjaxLoad: function () {
            try {
                return $u.hasContent(caap.ajaxLoadIcon) && caap.ajaxLoadIcon.css("display") !== "none";
            } catch (err) {
                $u.error("ERROR in waitingAjaxLoad: " + err);
                return false;
            }
        },

        isDOMSubtreeModifiedSupported: false,

        stsPoll: function () {
            try {
                var gtv = $j("span[id*='gold_time_value']", caap.globalContainer).text(),
                    ecv = $j("span[id*='energy_current_value']", caap.globalContainer).text(),
                    scv = $j("span[id*='stamina_current_value']", caap.globalContainer).text(),
                    hcv = $j("span[id*='health_current_value']", caap.globalContainer).text(),
                    arr = [],
                    num = 0;

                /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
                /*jslint sub: true */
                arr = $u.setContent($u.setContent(gtv, '').regex(/(\d+):(\d+)/), []);
                if ($u.hasContent(arr) && arr.length === 2) {
                    caap.stats['gold']['ticker'] = arr;
                    $u.log(3, "stsPoll gtv", arr[0] + ":" + (arr[1] < 10 ? '0' + arr[1] : arr[1]));
                }

                num = $u.setContent($u.setContent(ecv, '').parseInt(), -1);
                if (num > 0 && !$u.isNaN(num)) {
                    caap.stats['energy'] = $u.setContent(caap.getStatusNumbers(num + "/" + caap.stats['energy']['max']), caap.stats['energy']);
                    caap.stats['energyT'] = $u.setContent(caap.getStatusNumbers(num + "/" + caap.stats['energyT']['max']), caap.stats['energy']);
                    $u.log(3, "stsPoll ecv", num);
                }

                num = $u.setContent($u.setContent(hcv, '').parseInt(), -1);
                if (num > 0 && !$u.isNaN(num)) {
                    caap.stats['health'] = $u.setContent(caap.getStatusNumbers(num + "/" + caap.stats['health']['max']), caap.stats['health']);
                    caap.stats['healthT'] = $u.setContent(caap.getStatusNumbers(num + "/" + caap.stats['healthT']['max']), caap.stats['healthT']);
                    $u.log(3, "stsPoll hcv", num);
                }

                num = $u.setContent($u.setContent(scv, '').parseInt(), -1);
                if (num > 0 && !$u.isNaN(num)) {
                    caap.stats['stamina'] = $u.setContent(caap.getStatusNumbers(num + "/" + caap.stats['stamina']['max']), caap.stats['stamina']);
                    caap.stats['staminaT'] = $u.setContent(caap.getStatusNumbers(num + "/" + caap.stats['staminaT']['max']), caap.stats['staminaT']);
                    $u.log(3, "stsPoll scv", num);
                }
                /*jslint sub: false */
                return true;
            } catch (err) {
                $u.error("ERROR in stsPoll: " + err);
                return false;
            }
        },

        mainLoop: function () {
            try {
                var button          = null,
                    noWindowLoad    = 0,
                    actionsListCopy = [],
                    action          = 0,
                    len             = 0;

                // assorted errors...
                if (caap.errorCheck()) {
                    return true;
                }

                if (caap.domain.which === 1) {
                    gifting.collect();
                    caap.waitMainLoop();
                    return true;
                }

                //We don't need to send out any notifications
                button = $j("a[class*='undo_link']");
                if ($u.hasContent(button)) {
                    $u.log(1, 'Undoing/skipping notification');
                    caap.click(button);
                }

                if (!caap.isDOMSubtreeModifiedSupported) {
                    caap.stsPoll();
                }

                if (config.getItem('Disabled', false)) {
                    caap.waitMainLoop();
                    return true;
                }

                if (!caap.pageLoadOK) {
                    noWindowLoad = state.getItem('NoWindowLoad', 0);
                    if (noWindowLoad === 0) {
                        schedule.setItem('NoWindowLoadTimer', Math.min(Math.pow(2, noWindowLoad - 1) * 15, 3600));
                        state.setItem('NoWindowLoad', 1);
                    } else if (schedule.check('NoWindowLoadTimer')) {
                        schedule.setItem('NoWindowLoadTimer', Math.min(Math.pow(2, noWindowLoad - 1) * 15, 3600));
                        state.setItem('NoWindowLoad', noWindowLoad + 1);
                        caap.reloadCastleAge();
                    }

                    $u.log(1, 'Page no-load count: ', noWindowLoad);
                    caap.pageLoadOK = caap.getStats();
                    caap.waitMainLoop();
                    return true;
                } else {
                    state.setItem('NoWindowLoad', 0);
                }

                if (state.getItem('caapPause', 'none') !== 'none') {
                    caap.waitMainLoop();
                    return true;
                }

                if (caap.waitingForDomLoad) {
                    if (schedule.since('clickedOnSomething', 45)) {
                        $u.log(1, 'Clicked on something, but nothing new loaded.  Reloading page.');
                        caap.reloadCastleAge();
                        return true;
                    }

                    if (caap.waitingAjaxLoad()) {
                        $u.log(1, 'Waiting for page load ...');
                        caap.waitMainLoop();
                        return true;
                    }
                }

                if (caap.delayMain) {
                    $u.log(2, 'Delay main ...');
                    caap.waitMainLoop();
                    return true;
                }

                if (caap.autoIncome()) {
                    caap.checkLastAction('autoIncome');
                    caap.waitMainLoop();
                    return true;
                }

                actionsListCopy = caap.actionsList.slice();
                len = state.getItem('ReleaseControl', false) ? state.setItem('ReleaseControl', false) : actionsListCopy.unshift(state.getItem('LastAction', 'idle'));
                monster.select();
                for (action = 0, len = actionsListCopy.indexOf('idle') + 1; action < len; action += 1) {
                    if (caap[actionsListCopy[action]]()) {
                        caap.checkLastAction(actionsListCopy[action]);
                        break;
                    }
                }

                caap.waitMainLoop();
                return true;
            } catch (err) {
                $u.error("ERROR in mainLoop: " + err);
                return false;
            }
        },

        waitMilliSecs: 5000,

        waitMainLoop: function () {
            try {
                window.setTimeout(function () {
                    caap.waitMilliSecs = 5000;
                    if (caap.flagReload) {
                        caap.reloadCastleAge();
                    }

                    caap.mainLoop();
                }, caap.waitMilliSecs * (1 + Math.random() * 0.2));

                return true;
            } catch (err) {
                $u.error("ERROR in waitMainLoop: " + err);
                return false;
            }
        },

        reloadCastleAge: function (force) {
            try {
                // better than reload... no prompt on forms!
                if (force || !config.getItem('Disabled') && (state.getItem('caapPause') === 'none')) {
                    caap.visitUrl(caap.domain.link + (caap.domain.which === 0 || caap.domain.which === 2 ? "/index.php?bm=1&ref=bookmarks&count=0" : ""));
                }

                return true;
            } catch (err) {
                $u.error("ERROR in reloadCastleAge: " + err);
                return false;
            }
        },

        reloadOccasionally: function () {
            try {
                var reloadMin = config.getItem('ReloadFrequency', 8);
                reloadMin = !$u.isNumber(reloadMin) || reloadMin < 8 ? 8 : reloadMin;
                window.setTimeout(function () {
                    if (schedule.since('clickedOnSomething', 300) || caap.pageLoadCounter > 40) {
                        $u.log(1, 'Reloading if not paused after inactivity');
                        caap.flagReload = true;
                    }

                    caap.reloadOccasionally();
                }, 60000 * reloadMin + (reloadMin * 60000 * Math.random()));

                return true;
            } catch (err) {
                $u.error("ERROR in reloadOccasionally: " + err);
                return false;
            }
        },

        exportTable: {
            'Config' : {
                'export' : function () {
                    return config.options;
                },
                'import' : function (d) {
                    config.options = d;
                    config.save();
                },
                'delete' : function () {
                    config.options = {};
                    gm.deleteItem("config.options");
                }
            },
            'State' : {
                'export' : function () {
                    return state.flags;
                },
                'import' : function (d) {
                    state.flags = d;
                    state.save();
                },
                'delete' : function () {
                    state.flags = {};
                    gm.deleteItem("state.flags");
                }
            },
            'Schedule' : {
                'export' : function () {
                    return schedule.timers;
                },
                'import' : function (d) {
                    schedule.timers = d;
                    schedule.save();
                },
                'delete' : function () {
                    schedule.timers = {};
                    gm.deleteItem("schedule.timers");
                }
            },
            'Monster' : {
                'export' : function () {
                    return monster.records;
                },
                'import' : function (d) {
                    monster.records = d;
                    monster.save();
                },
                'delete' : function () {
                    monster.records = [];
                    gm.deleteItem("monster.records");
                }
            },
            'Battle' : {
                'export' : function () {
                    return battle.records;
                },
                'import' : function (d) {
                    battle.records = d;
                    battle.save();
                },
                'delete' : function () {
                    battle.records = [];
                    gm.deleteItem("battle.records");
                }
            },
            'Guild Monster' : {
                'export' : function () {
                    return guild_monster.records;
                },
                'import' : function (d) {
                    guild_monster.records = d;
                    guild_monster.save();
                },
                'delete' : function () {
                    guild_monster.records = [];
                    gm.deleteItem("guild_monster.records");
                }
            },
            'Target' : {
                'export' : function () {
                    return caap.reconRecords;
                },
                'import' : function (d) {
                    caap.reconRecords = d;
                    caap.saveRecon();
                },
                'delete' : function () {
                    caap.reconRecords = [];
                    gm.deleteItem("recon.records");
                }
            },
            'User' : {
                'export' : function () {
                    return caap.stats;
                },
                'import' : function (d) {
                    caap.stats = d;
                    caap.saveStats();
                },
                'delete' : function () {
                    caap.stats = {};
                    gm.deleteItem("stats.record");
                }
            },
            'Generals' : {
                'export' : function () {
                    return general.records;
                },
                'import' : function (d) {
                    general.records = d;
                    general.save();
                },
                'delete' : function () {
                    general.records = [];
                    gm.deleteItem("general.records");
                }
            },
            /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
            /*jslint sub: true */
            'Soldiers' : {
                'export' : function () {
                    return town['soldiers'];
                },
                'import' : function (d) {
                    town['soldiers'] = d;
                    town.save('soldiers');
                },
                'delete' : function () {
                    town['soldiers'] = [];
                    gm.deleteItem("soldiers.records");
                }
            },
            'Item' : {
                'export' : function () {
                    return town['item'];
                },
                'import' : function (d) {
                    town['item'] = d;
                    town.save('item');
                },
                'delete' : function () {
                    town['item'] = [];
                    gm.deleteItem("item.records");
                }
            },
            'Magic' : {
                'export' : function () {
                    return town['magic'];
                },
                'import' : function (d) {
                    town['magic'] = d;
                    town.save('magic');
                },
                'delete' : function () {
                    town['magic'] = [];
                    gm.deleteItem("magic.records");
                }
            },
            /*jslint sub: false */
            'Gift Stats' : {
                'export' : function () {
                    return gifting.history.records;
                },
                'import' : function (d) {
                    gifting.history.records = d;
                    gifting.save('history');
                },
                'delete' : function () {
                    gifting.history.records = [];
                    gm.deleteItem("gifting.history");
                }
            },
            'Gift Queue' : {
                'export' : function () {
                    return gifting.queue.records;
                },
                'import' : function (d) {
                    gifting.queue.records = d;
                    gifting.save('queue');
                },
                'delete' : function () {
                    gifting.queue.records = [];
                    gm.deleteItem("gifting.queue");
                }
            },
            'Gifts' : {
                'export' : function () {
                    return gifting.gifts.records;
                },
                'import' : function (d) {
                    gifting.queue.records = d;
                    gifting.save('gifts');
                },
                'delete' : function () {
                    gifting.queue.records = [];
                    gm.deleteItem("gifting.gifts");
                }
            },
            /*'Arena' : {
                'export' : function () {
                    return arena.records;
                },
                'import' : function (d) {
                    arena.records = d;
                    arena.save();
                },
                'delete' : function () {
                arena.records = [];
                    gm.deleteItem("arena.records");
                }
            },*/
            'Army' : {
                'export' : function () {
                    return army.records;
                },
                'import' : function (d) {
                    army.records = d;
                    army.save();
                },
                'delete' : function () {
                    army.records = [];
                    gm.deleteItem("army.records");
                }
            },
            'Demi Points' : {
                'export' : function () {
                    return caap.demi;
                },
                'import' : function (d) {
                    caap.demi = d;
                    caap.SaveDemi();
                },
                'delete' : function () {
                    caap.demi = {};
                    gm.deleteItem("demipoint.records");
                }
            },
            'Feed' : {
                'export' : function () {
                    return feed.records;
                },
                'import' : function (d) {
                    feed.records = d;
                    feed.save();
                },
                'delete' : function () {
                    feed.records = {};
                    gm.deleteItem("feed.records");
                }
            },
            'Monster List' : {
                'export' : function () {
                    return feed.monsterList;
                },
                'import' : function (d) {
                    feed.monsterList = d;
                    feed.saveList();
                },
                'delete' : function () {
                    feed.monsterList = [];
                    gm.deleteItem("feed.monsterList");
                }
            },
            'Goblin Hints' : {
                'export' : function () {
                    return spreadsheet.records;
                },
                'import' : function (d) {
                    spreadsheet.records = d;
                    spreadsheet.save();
                },
                'delete' : function () {
                    spreadsheet.records = [];
                    ss.deleteItem("spreadsheet.records");
                }
            }
        },

        exportList: function () {
            try {
                var it,
                    list = [];

                for (it in caap.exportTable) {
                    if (caap.exportTable.hasOwnProperty(it)) {
                        list.push(it);
                    }
                }

                return list.sort();
            } catch (err) {
                $u.error("ERROR in caap.exportList: " + err);
                return undefined;
            }
        },

        exportDialog: function (data, title) {
            try {
                var h = '',
                    w = $j("#caap_export");

                if (!$u.hasContent(w)) {
                    h = "<textarea style='resize:none;width:400px;height:400px;' readonly='readonly'>" + JSON.stringify(data, null, "\t") + "</textarea>";
                    w = $j('<div id="caap_export" class="caap_ff caap_fs" title="Export ' + title + ' Data">' + h + '</div>').appendTo(document.body);
                    w.dialog({
                        resizable : false,
                        width     : 'auto',
                        height    : 'auto',
                        buttons   : {
                            "Ok": function () {
                                w.dialog("destroy").remove();
                            }
                        },
                        close     : function () {
                            w.dialog("destroy").remove();
                        }
                    });
                }

                return w;
            } catch (err) {
                $u.error("ERROR in caap.exportDialog: " + err);
                return undefined;
            }
        },

        importDialog: function (which) {
            try {
                var h    = '',
                    w    = $j("#caap_import"),
                    l    = {},
                    v    = '',
                    resp = false;

                if (!$u.hasContent(w)) {
                    h = "<textarea id='caap_import_data' style='resize:none;width:400px;height:400px;'></textarea>";
                    w = $j('<div id="caap_import" class="caap_ff caap_fs" title="Import ' + which + ' Data">' + h + '</div>').appendTo(document.body);
                    w.dialog({
                        resizable : false,
                        width     : 'auto',
                        height    : 'auto',
                        buttons   : {
                            "Ok": function () {
                                try {
                                    v = JSON.parse($u.setContent($j("#caap_import_data", w).val(), 'null'));
                                } catch (e) {
                                    v = null;
                                }

                                l = $u.setContent(v, 'default');
                                if (($j.isArray(l) || $j.isPlainObject(l)) && l !== 'default') {
                                    resp = confirm("Are you sure you want to load " + which + "?");
                                    if (resp) {
                                        caap.exportTable[which]['import'](l);
                                        w.dialog("destroy").remove();
                                        caap.reloadCastleAge(true);
                                    }
                                } else {
                                    $u.warn(which + " config was not loaded!", l);
                                }
                            },
                            "Close": function () {
                                w.dialog("destroy").remove();
                            }
                        },
                        close     : function () {
                            w.dialog("destroy").remove();
                        }
                    });
                }

                return w;
            } catch (err) {
                $u.error("ERROR in caap.importDialog: " + err);
                return undefined;
            }
        },

        deleteDialog: function (which) {
            try {
                var resp = confirm("Are you sure you want to delete " + which + "?");
                if (resp) {
                    caap.exportTable[which]['delete']();
                    caap.reloadCastleAge(true);
                }

                return true;
            } catch (err) {
                $u.error("ERROR in caap.deleteDialog: " + err);
                return false;
            }
        },

        actionDialog: function () {
            try {
                var h  = '',
                    w  = $j("#caap_action"),
                    csa = $j(),
                    it = 0,
                    jt = '',
                    t  = '';

                if (!$u.hasContent(w)) {
                    for (it = 0; it < caap.actionsList.length; it += 1) {
                        for (jt in caap.masterActionList) {
                            if (caap.masterActionList.hasOwnProperty(jt)) {
                                if (caap.actionsList[it] === caap.masterActionList[jt]) {
                                    h += "<li id='caap_action_" + jt + "' class='" + (caap.masterActionList[jt] === 'idle' ? "ui-state-highlight" : "ui-state-default") + "'>" + caap.actionsList[it] + "</li>";
                                }

                                if (it === 0) {
                                    t += $u.dec2hex(jt.parseInt()) + ',';
                                }
                            }
                        }
                    }

                    t = t.substring(0, t.length - 1);
                    w = $j('<div id="caap_action" class="caap_ff caap_fs" title="Action Order"><div style="margin:20px 0px; width: 150px; height: 480px;">' + caap.makeCheckTR('Disable AutoIncome', 'disAutoIncome', false, '') + '<ul class="caap_ul" id="caap_action_sortable">' + h + '</ul></div></div>').appendTo(document.body);
                    csa = $j("#caap_action_sortable", w);
                    w.dialog({
                        resizable : false,
                        modal     : true,
                        width     : '200px',
                        height    : 'auto',
                        buttons   : {
                            "Ok": function () {
                                var result = csa.sortable('toArray'),
                                    s      = '';

                                for (it = 0; it < result.length; it += 1) {
                                    s += $u.dec2hex(result[it].regex(/(\d+)/)) + (it < result.length - 1 ? ',' : '');
                                }

                                if (s === t) {
                                    $u.log(1, "Reset actionOrder to default", config.setItem("actionOrder", ''));
                                } else {
                                    $u.log(1, "Saved actionOrder to user preference", config.setItem("actionOrder", s));
                                }

                                $u.log(1, "Change: setting 'disAutoIncome' to ", config.setItem("disAutoIncome", $j("#caap_disAutoIncome", w).attr("checked")));
                                w.dialog("destroy").remove();
                                caap.actionsList = [];
                                caap.makeActionsList();
                            },
                            "Reset": function () {
                                $u.log(1, "Reset actionOrder to default", config.setItem("actionOrder", ''));
                                $u.log(1, "Change: setting 'disAutoIncome' to ", config.setItem("disAutoIncome", false));
                                $j("#caap_disAutoIncome", w).attr("checked", false);
                                caap.actionsList = [];
                                caap.makeActionsList();
                                var ht = '',
                                    xt = '';

                                for (xt in caap.masterActionList) {
                                    if (caap.masterActionList.hasOwnProperty(xt)) {
                                        ht += "<li id='caap_action_" + xt + "' class='" + (caap.masterActionList[xt] === 'idle' ? "ui-state-highlight" : "ui-state-default") + "'>" + caap.masterActionList[xt] + "</li>";
                                    }
                                }

                                csa.html(ht).sortable("refresh");
                            }
                        },
                        close     : function () {
                            w.dialog("destroy").remove();
                        }
                    });

                    csa.sortable({
                        containment: w,
                        placeholder: "ui-state-highlight"
                    }).disableSelection();
                }

                return w;
            } catch (err) {
                $u.error("ERROR in caap.actionDialog: " + err);
                return undefined;
            }
        },

        ///////////////////////////
        //       Extend jQuery
        ///////////////////////////
        jQueryExtend: function () {
            (function ($) {
                /* This section is formatted to allow Advanced Optimisation by the Closure Compiler */
                /*jslint sub: true */
                jQuery.fn['getPercent'] = jQuery.fn.getPercent = function (type) {
                    var t = [];
                    if (!type || type === 'width') {
                        t = this.attr("style").match(/width:\s*([\d\.]+)%/i);
                    } else if (!type || type === 'height') {
                        t = this.attr("style").match(/height:\s*([\d\.]+)%/i);
                    }

                    return (t && t.length >= 2 && t[1]) ? parseFloat(t[1]) : 0;
                };

                jQuery.fn.justtext = function () {
                    return $(this).clone().children().remove().end().text();
                };

                jQuery.fn['colorInput'] = jQuery.fn.colorInput = function (farb_callback, diag_callback) {
                    var t = this,
                        v = jQuery("<div id='" + t.attr("id") + "_diag'></div>").appendTo(document.body),
                        w,
                        x;

                    v.dialog({
                        title     : t.attr("id"),
                        resizable : false,
                        top       : t.offset().top + 'px',
                        left      : (window.innerWidth / 2) + 'px',
                        width     : 'auto',
                        height    : 'auto',
                        buttons   : {
                            "Ok": function () {
                                v.dialog("destroy").remove();
                                if (utility.isFunction(diag_callback)) {
                                    diag_callback(t.attr("id"), t.val());
                                }
                            }
                        },
                        close     : function () {
                            v.dialog("destroy").remove();
                            if (utility.isFunction(diag_callback)) {
                                diag_callback(t.attr("id"), 'close');
                            }
                        }
                    });

                    w = jQuery("<div id='" + t.attr("id") + "_farb'></div>").appendTo(v);
                    x = jQuery.farbtastic(w, function (c) {
                        c = c.toUpperCase();
                        w.css({
                            background : c,
                            color      : utility.bestTextColor(c)
                        });

                        t.css({
                            background: c,
                            color      : utility.bestTextColor(c)
                        });

                        t.val(c);
                        if (utility.isFunction(farb_callback)) {
                            farb_callback(c);
                        }
                    }).setColor(t.val());

                    return [v, w, x];
                };

                jQuery.fn['alert'] = jQuery.fn.alert = function (html) {
                    var w = jQuery('<div id="alert_' + new Date().getTime() + '" title="Alert!">' + (html ? html : '') + '</div>').appendTo(document.body);

                    w.dialog({
                        buttons: {
                            "Ok": function () {
                                w.dialog("destroy").remove();
                            }
                        }
                    });

                    return w;
                };

                /*jslint nomen: false */
                /* Create an array with the values of all the checkboxes in a column */
                jQuery.fn.dataTableExt.afnSortData['dom-checkbox'] = function (oSettings, iColumn) {
                    var aData = [];
                    jQuery('td:eq(' + iColumn + ') input', oSettings.oApi._fnGetTrNodes(oSettings)).each(function () {
                        aData.push(this.checked === true ? "1" : "0");
                    });

                    return aData;
                };

                jQuery.fn.dataTableExt.afnSortData['remaining-time'] = function (oSettings, iColumn) {
                    var aData = [];
                    jQuery('td:eq(' + iColumn + ')', oSettings.oApi._fnGetTrNodes(oSettings)).each(function () {
                        aData.push(jQuery(this).text().lpad("0", 9));
                    });

                    return aData;
                };

                jQuery.fn.dataTableExt.afnSortData['scan-date'] = function (oSettings, iColumn) {
                    var aData = [];
                    jQuery('td:eq(' + iColumn + ')', oSettings.oApi._fnGetTrNodes(oSettings)).each(function () {
                        aData.push(jQuery(this).text().split("-").reverse().join("-"));
                    });

                    return aData;
                };
                /*jslint nomen: true */
                /*jslint sub: false */
            }(jQuery));
        }
    };

    /* This section is added to allow Advanced Optimisation by the Closure Compiler */
    /*jslint sub: true */
    window['caap'] = caap;
    caap['checkResults_index'] = caap.checkResults_index;
    caap['checkResults_fightList'] = caap.checkResults_fightList;
    caap['checkResults_viewFight'] = caap.checkResults_viewFight;
    caap['checkResults_fightList'] = caap.checkResults_fightList;
    caap['checkResults_viewFight'] = caap.checkResults_viewFight;
    caap['checkResults_land'] = caap.checkResults_land;
    caap['checkResults_generals'] = caap.checkResults_generals;
    caap['checkResults_quests'] = caap.checkResults_quests;
    caap['checkResults_gift_accept'] = caap.checkResults_gift_accept;
    caap['checkResults_army'] = caap.checkResults_army;
    caap['checkResults_keep'] = caap.checkResults_keep;
    caap['checkResults_oracle'] = caap.checkResults_oracle;
    caap['checkResults_alchemy'] = caap.checkResults_alchemy;
    caap['checkResults_battlerank'] = caap.checkResults_battlerank;
    caap['checkResults_war_rank'] = caap.checkResults_war_rank;
    caap['checkResults_achievements'] = caap.checkResults_achievements;
    caap['checkResults_battle'] = caap.checkResults_battle;
    caap['checkResults_soldiers'] = caap.checkResults_soldiers;
    caap['checkResults_item'] = caap.checkResults_item;
    caap['checkResults_magic'] = caap.checkResults_magic;
    caap['checkResults_gift'] = caap.checkResults_gift;
    caap['checkResults_goblin_emp'] = caap.checkResults_goblin_emp;
    caap['checkResults_view_class_progress'] = caap.checkResults_view_class_progress;
    caap['checkResults_guild'] = caap.checkResults_guild;
    caap['checkResults_guild_current_battles'] = caap.checkResults_guild_current_battles;
    caap['checkResults_guild_current_monster_battles'] = caap.checkResults_guild_current_monster_battles;
    caap['checkResults_guild_battle_monster'] = caap.checkResults_guild_battle_monster;
    //caap['checkResults_arena'] = caap.checkResults_arena;
    //caap['checkResults_arena_battle'] = caap.checkResults_arena_battle;
    caap['autoElite'] = caap.autoElite;
    caap['heal'] = caap.heal;
    caap['immediateBanking'] = caap.immediateBanking;
    caap['immediateAutoStat'] = caap.immediateAutoStat;
    caap['maxEnergyQuest'] = caap.maxEnergyQuest;
    caap['monsterReview'] = caap.monsterReview;
    caap['guildMonsterReview'] = caap.guildMonsterReview;
    caap['guildMonster'] = caap.guildMonster;
    caap['demiPoints'] = caap.demiPoints;
    caap['monsters'] = caap.monsters;
    caap['battle'] = caap.battle;
    caap['quests'] = caap.quests;
    caap['bank'] = caap.bank;
    caap['passiveGeneral'] = caap.passiveGeneral;
    caap['lands'] = caap.lands;
    caap['autoBless'] = caap.autoBless;
    caap['autoStat'] = caap.autoStat;
    caap['autoGift'] = caap.autoGift;
    caap['autoPotions'] = caap.autoPotions;
    caap['autoAlchemy'] = caap.autoAlchemy;
    caap['idle'] = caap.idle;
    caap['autoIncome'] = caap.autoIncome;
    //caap['arena'] = caap.arena;
    //caap['arenaReview'] = caap.arenaReview;
    /*jslint sub: false */

    //////////////////////////////////
    //       Functions
    //////////////////////////////////

    function caap_log(msg) {
        if (window.console && typeof console.log === 'function') {
            console.log(caapVersion + (devVersion !== '0' ? 'd' + devVersion : '') + ' |' + (new Date()).toLocaleTimeString() + '| ' + msg);
        }
    }

    function injectScript(url) {
        var inject = document.createElement('script');
        inject.setAttribute('type', 'text/javascript');
        inject.setAttribute('src', url);
        (document.head || document.getElementsByTagName('head')[0]).appendChild(inject);
        caap.removeLibs.push(inject);
    }

    function caap_DomTimeOut() {
        caap_log("DOM onload timeout!!! Reloading ...");
        if (typeof window.location.reload === 'function') {
            window.location.reload();
        } else if (typeof history.go === 'function') {
            history.go(0);
        } else {
            window.location.href = window.location.href;
        }
    }

    function caap_WaitForutility() {
        if (window.utility) {
            caap_log("utility ready ...");
            $j(function () {
                caap.start();
            }).ready();
        } else {
            caap_log("Waiting for utility ...");
            window.setTimeout(caap_WaitForutility, 100);
        }
    }

    function caap_WaitForDataTable() {
        if (window.jQuery().dataTable) {
            caap_log("dataTable ready ...");
            if (!window.utility) {
                caap_log("Inject utility.");
                injectScript(caap.libs.utility);
            }

            caap_WaitForutility();
        } else {
            caap_log("Waiting for dataTable ...");
            window.setTimeout(caap_WaitForDataTable, 100);
        }
    }

    function caap_WaitForFarbtastic() {
        if (window.jQuery.farbtastic) {
            caap_log("farbtastic ready ...");
            if (!window.jQuery().dataTable) {
                caap_log("Inject dataTable.");
                injectScript(caap.libs.dataTables);
            }

            caap_WaitForDataTable();
        } else {
            caap_log("Waiting for farbtastic ...");
            window.setTimeout(caap_WaitForFarbtastic, 100);
        }
    }

    function caap_WaitForjQueryUI() {
        if (window.jQuery.ui) {
            caap_log("jQueryUI ready ...");
            if (!window.jQuery.farbtastic) {
                caap_log("Inject farbtastic.");
                injectScript(caap.libs.farbtastic);
            }

            caap_WaitForFarbtastic();
        } else {
            caap_log("Waiting for jQueryUI ...");
            window.setTimeout(caap_WaitForjQueryUI, 100);
        }
    }

    function caap_WaitForjQuery() {
        if (window.jQuery && window.jQuery().jquery === "1.6") {
            caap_log("jQuery ready ...");
            if (!window.$j) {
                window.$j = window.jQuery.noConflict();
            } else {
                if (!window.caap_comms) {
                    throw "$j is already in use!";
                }
            }

            if (!window.jQuery.ui) {
                caap_log("Inject jQueryUI.");
                injectScript(caap.libs.jQueryUI);
            }

            caap_WaitForjQueryUI();
        } else {
            caap_log("Waiting for jQuery ...");
            window.setTimeout(caap_WaitForjQuery, 100);
        }
    }

    /////////////////////////////////////////////////////////////////////
    //                         Begin
    /////////////////////////////////////////////////////////////////////
    caap_log(window.navigator.userAgent);
    if (typeof CAAP_SCOPE_RUN !== 'undefined') {
        caap_log('Remote version: ' + CAAP_SCOPE_RUN[0] + ' ' + CAAP_SCOPE_RUN[1] + ' d' + CAAP_SCOPE_RUN[2]);
    }

    (function () {
        function setDSMSupported() {
            caap.isDOMSubtreeModifiedSupported = true;
        }

        var el = document.createElement('div');
        el.addEventListener("DOMSubtreeModified", setDSMSupported, false);
        el.innerHTML = "set";
        el.removeEventListener("DOMSubtreeModified", setDSMSupported, false);
        el = null;
    }());

    caap_log("Starting ... waiting for libraries and DOM load");
    caap_timeout = window.setTimeout(caap_DomTimeOut, 180000);
    if (!window.jQuery || window.jQuery().jquery !== "1.6") {
        caap_log("Inject jQuery");
        injectScript(caap.libs.jQuery);
    }

    caap_WaitForjQuery();

}());

// ENDOFSCRIPT
